How to split letters in a word into an array
36 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Jan
2013 年 7 月 1 日
The string 'Hello' consists of single characters already:
str = 'Hello';
for k = 1:length(str)
disp(str(k))
end
So please explain the wanted type and dimensions of the output. 'H' 'E' 'L' 'L' 'O' is not clear enough.
4 件のコメント
Adam Danz
2021 年 5 月 25 日
☝ num2cell is the best solution. In case str is of class string
c = num2cell(char(str));
This works when str is a character array or a string.
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!