I want to convert array to table and add labels too.

2 visualizaciones (últimos 30 días)
haider mehraj
haider mehraj el 24 de Jul. de 2018
Comentada: Walter Roberson el 24 de Jul. de 2018
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??

Respuestas (1)

Walter Roberson
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
haider mehraj
haider mehraj el 24 de Jul. de 2018
I am not using cellarray..data is as numeric array..
Walter Roberson
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

Iniciar sesión para comentar.

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by