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
回答(2 个)
Azzi Abdelmalek
2013-3-24
编辑:Azzi Abdelmalek
2013-3-24
out=cellstr(reshape('A':'I',[],3)')'
3 个评论
Jayden Deng
2013-3-24
Jayden Deng
2013-3-24
Azzi Abdelmalek
2013-3-24
编辑:Azzi Abdelmalek
2013-3-24
If there is not any pattern, you have to enter them manually, then use reshape function
Walter Roberson
2013-3-25
0 个投票
If the variable is currently a char array, then use cellstr() to convert to a cell array.
类别
在 帮助中心 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!