How to convert a list in the variable into a cell array
Afficher commentaires plus anciens
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
1 commentaire
Azzi Abdelmalek
le 24 Mar 2013
It should be ABC DEF GHI
Réponses (2)
Azzi Abdelmalek
le 24 Mar 2013
Modifié(e) : Azzi Abdelmalek
le 24 Mar 2013
out=cellstr(reshape('A':'I',[],3)')'
3 commentaires
Jayden Deng
le 24 Mar 2013
Jayden Deng
le 24 Mar 2013
Azzi Abdelmalek
le 24 Mar 2013
Modifié(e) : Azzi Abdelmalek
le 24 Mar 2013
If there is not any pattern, you have to enter them manually, then use reshape function
Walter Roberson
le 25 Mar 2013
0 votes
If the variable is currently a char array, then use cellstr() to convert to a cell array.
Catégories
En savoir plus sur Cell Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!