#Day23- #100DaysChallenge- Matlab Loops| ChessBoard Matrix
#Day23-Chess Board Matrix
Task: Create a matrix with pixel value 0 and 255 as like chess board. Take row and column size from the user.
Matlab Code:
function chessboard(m,n)
for i=1:1:m
for j=1:1:n
if mod((i+j),2)==0
a(i,j)=0;
else
a(i,j)=255;
end
end
end
imshow(a);
end
Sample Input and Output:
chessboard(22,10)
Free program: https://www.matlabcoding.com
Free Codes: https://www.youtube.com/castorclasses
Free Support: castorclasses2014@gmail.com
Live Support: https://www.t.me/matlabcastor
Like us: https://www.facebook.com/matlabirawen/
Join us: https://www.facebook.com/groups/MATLABcodes
Share with us: https://www.quora.com/q/matlabirawen
Free Codes: https://www.youtube.com/castorclasses
Free Support: castorclasses2014@gmail.com
Live Support: https://www.t.me/matlabcastor
Like us: https://www.facebook.com/matlabirawen/
Join us: https://www.facebook.com/groups/MATLABcodes
Share with us: https://www.quora.com/q/matlabirawen
No comments