Printing table susing fprintf
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Maroulator
am 14 Mär. 2017
Beantwortet: Erick Miranda
am 29 Jan. 2020
I have the following script; my problem is that I cannot get all the values in A under column A in the frprintf. Any ideas?
A=[1;3;2;8;9]; B=2*pi*A; fprintf('A B\n'); fprintf('======\n'); fprintf('%d %d\n',A,B);
0 Kommentare
Akzeptierte Antwort
Jan
am 14 Mär. 2017
Bearbeitet: Jan
am 14 Mär. 2017
Use:
fprintf('%d %d\n', [A, B].');
Then the elements of A and B appear alternating in the provided array:
C = [A, B].';
C(:)
Note that Matlab addresses the matrix in columnwise order.
With the original command fprintf('%d %d\n',A,B); Matlab uses the format string to print all elements of A at first and then all of B, but not alternating.
0 Kommentare
Weitere Antworten (1)
Erick Miranda
am 29 Jan. 2020
Thank you, thank you...
fprintf('%d %d\n', [A, B].');
I have a question what is, or how does it work " .' "
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical 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!