Info

此问题已关闭。 请重新打开它进行编辑或回答。

Creating table with variablenames properts as an array

1 次查看(过去 30 天)
I create a table of the form:
Temp={'T_'}
rpm=[70; 80; 90]
Temperature=strcat(Temp,num2str(rpm))
TVALz=[190 220 300 140; 57 164 215 210; 109 45 67 220]
OuTABLE=table(Temperature,TVALz)
Giving:
Temperature TVALz
___________ ________________________
'T_70' 190 220 300 140
'T_80' 57 164 215 210
'T_90' 109 45 67 220
What I need is to have 4 individual headers (e.g. T1, T3, T6, T9) instead of the header "TVALz", so that the result would like:
Temperature T1 T3 T6 T9
___________ ________________________
'T_70' 190 220 300 140
'T_80' 57 164 215 210
'T_90' 109 45 67 220
I tried this:
Temp={'T_'}
rpm=[70; 80; 90]
Temperature=strcat(Temp,num2str(rpm))
TVALz=[190 220 300 140; 57 164 215 210; 109 45 67 220]
VarNames={'T1' 'T3' 'T6' 'T9'}
OuTABLE=table(Temperature,TVALz,'VariableNames',VarNames)
but it produced the erro message:
"Error using table (line 322)
The VariableNames property must contain one name for each variable in the table."
What am i doing wrong?

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by