Add Column and Row Labels to Matrix
287 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
balsip
am 16 Mai 2017
Kommentiert: Stuart McGarrity
am 27 Mai 2021
I'd like to add string data column and row labels (aka "headers") to a 5x13 matrix. I've expanded the matrix to 6x14 with NaNs to accommodate these labels on both the x and y.
I've tried the below threads' approaches, and I'm apparently missing something in each case, and am unable to modify to get them to work for me: https://www.mathworks.com/matlabcentral/newsreader/view_thread/245987 https://www.mathworks.com/matlabcentral/answers/89195-how-to-put-heading-for-columns-of-matrix
I'm really trying to stay out of the Excel world. Truly, I am... but this one is making that temptation hard to resist.
Thank you, everyone.
0 Kommentare
Akzeptierte Antwort
KL
am 16 Mai 2017
Bearbeitet: KL
am 16 Mai 2017
sample = rand(3,3);
rowNames = {'a','b','c'};
colNames = {'x','y','z'};
sTable = array2table(sample,'RowNames',rowNames,'VariableNames',colNames)
3 Kommentare
RISHABH RISHABH
am 22 Mai 2021
What to do if there are 100 columns as if there are 3 like above, we can easily name them as a,b,c. but i have a matrix which has 100 columns and 20 rows. help please
Stuart McGarrity
am 27 Mai 2021
sample=rand(20,100);
rowNames="row_"+ (1:20)'; % Doubles get converted to strings when they are concatenated with them
colNames="col_"+ (1:100);
sTable = array2table(sample,'RowNames',rowNames,'VariableNames',colNames);
Weitere Antworten (1)
ASHOK BANERJEE
am 20 Nov. 2020
I have a problem to label a data array as follows:
Air speed Ambient air temperaure (0 C)
v Ta
(km/h) 5 0 -5 -10 -15 -20 -25 -30 -35
15
30 This space to be filled with (Data array) wind chill temperature,(Twc) given
by the formulae
45 Twc=13.112+0.6215*Ta -11.37*v^0.16+0.3965*Ta*v^0.16
60
75
90
0 Kommentare
Siehe auch
Kategorien
Mehr zu Tables 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!