Name the first column in array2table
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
kimmy8
le 21 Nov 2019
Réponse apportée : Star Strider
le 21 Nov 2019
How do I name the first column of the table? I am able to name the other columns, but not the column that was not included in the 6x6 table. I want to name the first column Property. (in matlab R2019)
Property = {'Salinity','Oxygen','Nitrate','Silicate','Temperature','Phosphate'}
T = array2table(coeff,'VariableNames', {'Mode_1','Mode_2','Mode_3','Mode_4','Mode_5','Mode_6'},...
'RowNames', Property);
0 commentaires
Réponse acceptée
Star Strider
le 21 Nov 2019
The code you posted produces an acceptable table object.
I am not certain what you want. I am guessing here:
coeff = rand(6);
Property = table({'Salinity','Oxygen','Nitrate','Silicate','Temperature','Phosphate'}','VariableNames',{' '});
T = array2table(coeff,'VariableNames', {'Mode_1','Mode_2','Mode_3','Mode_4','Mode_5','Mode_6'})
T = addvars(T, Property, 'Before','Mode_1')
producing:
T =
6×7 table
Property Mode_1 Mode_2 Mode_3 Mode_4 Mode_5 Mode_6
_______________ _______ ________ _______ _______ _______ _______
{'Salinity' } 0.181 0.72568 0.33711 0.37855 0.32149 0.971
{'Oxygen' } 0.80879 0.15401 0.44594 0.42276 0.89985 0.55552
{'Nitrate' } 0.81906 0.50907 0.75765 0.97269 0.54211 0.76982
{'Silicate' } 0.48724 0.66804 0.13053 0.17702 0.46289 0.68012
{'Temperature'} 0.75505 0.15258 0.90151 0.88228 0.80797 0.2052
{'Phosphate' } 0.40437 0.062696 0.22034 0.55126 0.36082 0.83462
Please be specific if you want to do something else.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Distribution Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!