I want to insert a matrix into RowNames that exist in a table.
조회 수: 4 (최근 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에서 LaTeX에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!