Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Can someone help me? I am trying to print a 8-by-8 checkboard with red and black tiles

조회 수: 1 (최근 30일)
Kevin Junior
Kevin Junior 2013년 9월 24일
마감: MATLAB Answer Bot 2021년 8월 20일
I know that am gonna use two nested for loops.

답변 (2개)

Walter Roberson
Walter Roberson 2013년 9월 24일
No "for" loop is needed. You can index with an increment of 2.

Image Analyst
Image Analyst 2013년 9월 24일
편집: Image Analyst 2013년 9월 24일
Use the checkerboard() function in the Image Processing Toolbox:
cb = 255 * (checkerboard(20) > 0); % checkerboard.
blank = zeros(size(cb), 'uint8'); % Totally black image.
% Put checkboard into only the red channel of an RGB image.
rgbImage = cat(3,cb,blank,blank);
imshow(rgbImage)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by