필터 지우기
필터 지우기

How to create a checkerboard using fprintf?

조회 수: 2 (최근 30일)
Rafael
Rafael 2017년 11월 16일
댓글: Walter Roberson 2017년 11월 16일
I already have the code for the checkerboard. The problem is that the order of the symbols are not correct.
for a=1:10
for b=1:5
fprintf('X')
fprintf('O')
end
fprintf('\n')
end
I want it so the first row ends with O and the second row ends with X. Can you please help me on this with a simple solution that does not take a lot of lines.

채택된 답변

Walter Roberson
Walter Roberson 2017년 11월 16일
Add another for b loop that prints in the other order.
  댓글 수: 4
Rafael
Rafael 2017년 11월 16일
Nice, thank you.
Walter Roberson
Walter Roberson 2017년 11월 16일
You see, it was exactly what I said: adding another for b loop that printed in the other order.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Biological Physics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by