Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Can I update the units/properties of a time table using the head function?

1 visualización (últimos 30 días)
ZH
ZH el 22 de Jul. de 2020
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Instead of listing off each variable unit,
TT.Properties.VariableUnits = {'','C','kW','kW','Auxiliary','Auxiliary','Auxiliary','W','W','C'};
I am trying to grab each unit from the first header grabbed
Units = head(TT,1)
^^ then implement that into the variablunits??
Something is off on my end.
  3 comentarios
ZH
ZH el 23 de Jul. de 2020
Understood. Is there a way to change the properties to the first row of TT? Or do I have to list them out?
Star Strider
Star Strider el 23 de Jul. de 2020
The first row of the ‘TT’ table is likely data, do you can do anything with them that you want to (within limits).
If you want to change the variable names or units, you can address them individually (since they are cell arrays) to change any one or more of them. You would have to use the appropriate ‘TT.Properties.’ structure regardless.

Respuestas (1)

Cris LaPierre
Cris LaPierre el 23 de Jul. de 2020
If you are asking if MATLAB can automatically extract units from the column name (e.g. Time (mins)), the answer is no. You would have to write the code yourself to separate the two and then add the units to the table property.
You can set up your data file in a way that would allow MATLAB to read in your units automatically. The units would need to be on their own row. You would then need to set up import options by telling it which row contains the units. See here (for a spreadsheet).

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by