How can i name the column on a table ?
8 次查看(过去 30 天)
显示 更早的评论
HI everyone,
I have a matrix (82600x156 double) from a c3d file. I need to built a table and associate at each column a specific name. I already built a vector 'label' (1x156 cells). Using the command:
T = table (matrix, 'VariableNames', label)
the error is "The VariableNames property must contain one name for each variable in the table.".
I need this to save the table in .csv format.
If someone has suggestion about how my problem can be solved or another way to say labels and matrix on a cvs file it will be realy great !
0 个评论
采纳的回答
Stephen23
2021-5-26
编辑:Stephen23
2021-5-26
You created a table with one variable and one row, and that variable contains a large numeric matrix. This is not useful for you. If you want a table where each column is converted into a table variable/column then use array2table:
T = array2table(matrix, 'VariableNames', label)
4 个评论
Stephen23
2021-5-26
MATLAB R2019b and later will accept table variable names containing any characters.
If you are using an earlier version then the table variable names will need to be valid MATLAB variable names: https://www.mathworks.com/help/matlab/matlab_prog/variable-names.html
For example, this means you will need to remove the colon character.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!