I want to insert a matrix into RowNames that exist in a table.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
h=[2,4,6,8,10,12,14,20,30,50,100,1000]';
t=[2,4,6,8,10,12,14,16,18,20];
u=h*t;
q=strcat("T=",num2str(t'))';
p=strcat("H=",num2str(h))';
array2table(u, 'VariableNames',{num2str(q)},'RowNames',{num2str(p)})
hello.
I want to put a matrix into array2table as VariableNames,RowNames.
The code is an example.
I don't know what the problem is.
I've included a picture of the shape I want in the picture below.
The values of t and h and the size of the matrix can change, so simply do not do the code below.
result_ramda=array2table(ramda, 'VariableNames',{'T=2' 'T=4' 'T=6' 'T=8' 'T=10' 'T=12' 'T=14' 'T=16 ' 'T=18' 'T=20'},'RowNames',{'h=2' 'h=4' 'h=6' 'h=8' 'h=10' 'h=12' 'h = 14' 'h=20' 'h=30' 'h=50' 'h=100' 'h=1000'})
t and h are always of the form 1x Y or Yx1.

0 Kommentare
Akzeptierte Antwort
VBBV
am 7 Dez. 2022
h=[2,4,6,8,10,12,14,20,30,50,100,1000]';
t=[2,4,6,8,10,12,14,16,18,20];
u=h*t;
q=strcat("T=",string(t'))';
p=strcat("h=",string(h))';
array2table(u, 'VariableNames',string(q),'RowNames',string(p))
2 Kommentare
Stephen23
am 7 Dez. 2022
Simpler:
h = [2;4;6;8;10;12;14;20;30;50;100;1000];
t = [2,4,6,8,10,12,14,16,18,20];
u = h*t;
a = array2table(u, 'VariableNames',"T="+t,'RowNames',"H="+h)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu LaTeX 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!