How do I change column headers in my table
13 ビュー (過去 30 日間)
古いコメントを表示
I have some data that I am displaying in my script and have outputted it in 28 different tables. My script is quite long so I am just posting a screenshot for now.

Where is says var 2 I want to change to the storey number. So for table 1 I want storey 1, for table 2, storey 2 etc...
If you can see for the main output i am running a loop and using the matrix called "Int_force". I also have made the row headers as [Axial Force, Shear Force, Bending Moment. Thus, I am hoping someone can help me so that I can change the column headers to my desired wish? I am not sure how I would change the loop to accomplish this.
Many thanks,
Scott
1 件のコメント
採用された回答
Star Strider
2025 年 8 月 26 日
If your immediate problem is naming the variables, perhaps --
Int_force = randn(6,6,28);
Force = repmat(["Axial Force";"Shear Force";"Bending Moment"],2,1);
for ii = 1:28
T{:,ii} = table(Force,Int_force(:,:,ii), VariableNames=["Force","Storey "+ii]);
end
T{1:3}
Note that 'T' was being overwritten in every iteration of the loop, so I created a cell array of them.
Make appropriate changes to get the result you want.
.
4 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!