MATLAB Answers

How to read units from a column in a table in Matlab?

5 views (last 30 days)
Jason Burke
Jason Burke on 17 May 2021
Answered: Jason Burke on 17 May 2021
I read in a csv into a table and set each column's units with VariableUnits. I would like to be able to read the units for a certain column (say column 3, "Temp"). I would like to know if the temperature was recorded in degrees F or C or K.
I can use table{1,1}.Properties.VariableUnits to display the units for all the columns, but I can't figure out how to look up the units for just one column.
Also if I want to update the units for one column, how can I do that as well?

Answers (2)

Geoff Hayes
Geoff Hayes on 17 May 2021
Jason -
will get you the units for the second column.
T.Properties.VariableUnits{2} = 'NewUnit';
will update the unit name for that column.

Jason Burke
Jason Burke on 17 May 2021
I figured out that calling the column at the end of the statement is the way to reference the column.
Is the way to get the column information.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!