How to convert a list in the variable into a cell array

I have a list of names set as a variable and I would like to know how you can make that list into a cell array without typing each one out
for example my list
val=
ABC
DEF
GHK
can i make/convert that into an array without typing each one out like list={'ABC','DEF','GHK'} thanks

Respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 24 de Mzo. de 2013
Editada: Azzi Abdelmalek el 24 de Mzo. de 2013
out=cellstr(reshape('A':'I',[],3)')'

3 comentarios

but the thing is, i need to make very large variables into arrays and they do not have a pattern like A to I so how can i turn it into an array without writing out each one
also could i use the tabulate function to count as well?
Azzi Abdelmalek
Azzi Abdelmalek el 24 de Mzo. de 2013
Editada: Azzi Abdelmalek el 24 de Mzo. de 2013
If there is not any pattern, you have to enter them manually, then use reshape function

Iniciar sesión para comentar.

Walter Roberson
Walter Roberson el 25 de Mzo. de 2013
If the variable is currently a char array, then use cellstr() to convert to a cell array.

Categorías

Etiquetas

Preguntada:

el 24 de Mzo. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by