Trying to change cells in a table
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dylan Clark
el 28 de Mzo. de 2022
Comentada: Arif Hoq
el 30 de Mzo. de 2022
I have a small test table and I try to replace a column (or row) with the same size string. I just get NaN out of it. I would like to replace the table colum from (1,2,3,4,5) to type_1, type_2 etc. where the column names are in a 5x1 string. How can I do this? And how would it change for rows as well? Thanks
0 comentarios
Respuesta aceptada
Arif Hoq
el 28 de Mzo. de 2022
try this:
Column1Names={'type_1';'type_2';'type_3';'type_4';'type_5'};
% making another table
LastName = {'Sanchez';'Johnson';'Li';'Diaz';'Brown'};
Age = [38;43;38;40;49];
Height = [71;69;64;67;64];
Table2 = table(LastName,Age,Height)
Table2.LastName=Column1Names
Or
Table2(:,1)=Column1Names
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!