How do I display this Matrix using fprintf
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Olivia Martin
am 10 Apr. 2020
Kommentiert: KSSV
am 10 Apr. 2020
Hi, I'm sorry if I make any mistakes this is my first time posting.
This is my code so far
MatrixA = [100.9 100.8 110.0;102.0 101.0 108.0;104.0 100.1 107.0];
header = {'Batch1','Batch 2','Batch 3'};
MatrixAForDisplay = [header; num2cell(MatrixA)];
disp(MatrixAForDisplay);
My question is, how do I display this matrix using fprintf command?
Thank you so much in advance!
0 Kommentare
Akzeptierte Antwort
KSSV
am 10 Apr. 2020
header = {'Batch1','Batch 2','Batch 3'};
A = [100.9 100.8 110.0;102.0 101.0 108.0;104.0 100.1 107.0];
fprintf('%s %s %s\n',header{1},header{2},header{3})
fprintf('%f %f %f\n', A.')
It is better to convert them into table and print. Have a look on table.
2 Kommentare
KSSV
am 10 Apr. 2020
T = table(header,A(:1,),A(:,2),A(:,3))
Read amore here: https://in.mathworks.com/help/matlab/ref/table.html
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Type Conversion 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!