How to make checkboard with only 2 black box and white box using for loop

I am trying to make checkboard for only 2 black box and 2 white box diagonally using for loop the output i need to have is on this link thanks

Answers (2)

Without a for loop:
v = (1:128) > 64;
r = xor(v, v.'); % Auto expanding in Matlab 2016b
% r = bsxfun(@xor, v, v.') % Older Matlab versions
Thank you, yes it's a homework and I couldn't find away around for loop.

Categories

Tags

Asked:

on 12 Mar 2017

Answered:

on 12 Mar 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!