Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Can I update the units/properties of a time table using the head function?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Star Strider
am 23 Jul. 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.
Antworten (1)
Cris LaPierre
am 23 Jul. 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).
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!