How do I change column headers in my table
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Scott Banks
el 26 de Ag. de 2025
Comentada: Star Strider
el 26 de Ag. de 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 comentario
Respuesta aceptada
Star Strider
el 26 de Ag. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!