How do I change column headers in my table
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Scott Banks
le 26 Août 2025
Commenté : Star Strider
le 26 Août 2025
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 commentaire
Réponse acceptée
Star Strider
le 26 Août 2025
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Dates and Time dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!