Name the first column in array2table

12 visualizaciones (últimos 30 días)
kimmy8
kimmy8 el 21 de Nov. de 2019
Respondida: Star Strider el 21 de Nov. de 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);

Respuesta aceptada

Star Strider
Star Strider el 21 de Nov. de 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.

Más respuestas (0)

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by