How to convert a list in the variable into a cell array
Show older comments
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 Comment
Azzi Abdelmalek
on 24 Mar 2013
It should be ABC DEF GHI
Answers (2)
Azzi Abdelmalek
on 24 Mar 2013
Edited: Azzi Abdelmalek
on 24 Mar 2013
out=cellstr(reshape('A':'I',[],3)')'
3 Comments
Jayden Deng
on 24 Mar 2013
Jayden Deng
on 24 Mar 2013
Azzi Abdelmalek
on 24 Mar 2013
Edited: Azzi Abdelmalek
on 24 Mar 2013
If there is not any pattern, you have to enter them manually, then use reshape function
Walter Roberson
on 25 Mar 2013
0 votes
If the variable is currently a char array, then use cellstr() to convert to a cell array.
Categories
Find more on Cell Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!