How to create a checkerboard using fprintf?
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Walter Roberson
2017-11-16
Add another for b loop that prints in the other order.
4 个评论
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 Center 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!