I want to insert a matrix into RowNames that exist in a table.
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
VBBV
2022 年 12 月 7 日
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 件のコメント
Stephen23
2022 年 12 月 7 日
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)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!