Info

This question is closed. Reopen it to edit or answer.

Creating table with variablenames properts as an array

1 view (last 30 days)
Saeid
Saeid on 28 May 2019
Closed: MATLAB Answer Bot on 20 Aug 2021
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?

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!