Not able to excecute the code
显示 更早的评论
I am trying to execute following codes :
rows={'A','B'};
data = cell(0,5);
T = cell2table(data);
T.Properties.RowNames = rows;
Matlab is throwing an error :The RowNames property must contain one name for each row in the table.
Can anybody comment if I am missing anything? I will appreciate any help.
采纳的回答
更多回答(1 个)
Akshay Malav
2019-6-21
编辑:Akshay Malav
2019-6-21
First change the number of rows from 0 to 1 and correspondingly the rows array should contain only 1 element either 'A' or 'B'. Run it , it will work fine
Here is the code
rows={'A'};
data = cell(1,5);
T = cell2table(data);
T.Properties.RowNames = rows;
1 个评论
Walter Roberson
2019-6-21
Right. You can only have a row name for a row that exists. You cannot put in placeholder row names for rows to be added later.
类别
在 帮助中心 和 File Exchange 中查找有关 Tables 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!