Not able to excecute the code
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (1)
Akshay Malav
el 21 de Jun. de 2019
Editada: Akshay Malav
el 21 de Jun. de 2019
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 comentario
Walter Roberson
el 21 de Jun. de 2019
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.
Categorías
Más información sobre Tables en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!