Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
ZH
ZH 2020 年 7 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件のコメント
ZH
ZH 2020 年 7 月 23 日
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 2020 年 7 月 23 日
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.

回答 (1 件)

Cris LaPierre
Cris LaPierre 2020 年 7 月 23 日
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).

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by