Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Creating table with variablenames properts as an array

1 vue (au cours des 30 derniers jours)
Saeid
Saeid le 28 Mai 2019
Clôturé : MATLAB Answer Bot le 20 Août 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?
  2 commentaires
Saeid
Saeid le 28 Mai 2019
Thank you Stephen!

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by