How can I turn a 1*1 cell into a cell array?
12 次查看(过去 30 天)
显示 更早的评论
For example, what is the easiest way to turn a 1*1 cell 'a b c d e' into a cell array {'a'} {'b'} {'c'} {'d'} {'e'}? Please! Anyone can help me?
0 个评论
采纳的回答
Sameer
2024-8-19
编辑:Sameer
2024-8-19
Hi
To split a 1x1 cell containing a string and convert the result into a cell array, you can utilize the "strsplit" function.
originalCell = {'a b c d e'};
splitArray = strsplit(originalCell{1});
disp(splitArray);
Hope this helps!
3 个评论
Walter Roberson
2024-8-20
Another way:
originalCell = {'a b c d e'};
regexp(originalCell{1}, ' +', 'split')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!