How to change variable names to headings in table?
4 views (last 30 days)
Show older comments
I have the following table in my code:
table = table(ht,hGt,Tkt,Prt,Drt);
When the table is displayed I want each variable to be named under the following headings:
ht = "Geometric Altitude (km)"
hGt = "Geopotential Altitude (km)"
Tkt = "Temperature (K)"
Prt = "Pressure Ratio"
Drt = "Density Ratio"
What command can I use that allows me to use these heading, I haven't found one that allows me to use an invalid variable name.
Thanks, Jake
0 Comments
Answers (1)
Stephen23
on 25 Apr 2015
Edited: Stephen23
on 25 Apr 2015
names = {'GeometricAltitude_km', 'GeopotentialAltitude_km', 'Temperature_K', 'PressureRatio', 'DensityRatio};
table = table(ht,hGt,Tkt,Prt,Drt, 'VariableNames',names);
Edited to remove spaces from the cell array strings.
See Also
Categories
Find more on Cell Arrays in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!