How to create a checkerboard using fprintf?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rafael
am 16 Nov. 2017
Kommentiert: Walter Roberson
am 16 Nov. 2017
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 16 Nov. 2017
Add another for b loop that prints in the other order.
4 Kommentare
Walter Roberson
am 16 Nov. 2017
You see, it was exactly what I said: adding another for b loop that printed in the other order.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Biological Physics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!