I want to convert array to table and add labels too.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have 2000 columns in cell array.i want to have labels 'one' for first 10 columns and then labels 'two' for next ten columns. How to convert to table with labels as mentioned??
0 comentarios
Respuestas (1)
Walter Roberson
el 24 de Jul. de 2018
You can only merge into single variables if all of the values being merged are the same data type. As you want to do this for each group of 10 columns, that suggests that your columns are all the same data type, which leads us to question why you are using a cellarray instead of a numeric array.
2 comentarios
Walter Roberson
el 24 de Jul. de 2018
varnames = {'one', 'two', 'three', ....};
t = table();
for group = 1 : length(varnames)
t.(varnames{group}) = YourArray(:,(group-1)*10+1:group*10);
end
Ver también
Categorías
Más información sobre Tables 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!