Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Trasform number in strings
1 回表示 (過去 30 日間)
古いコメントを表示
Hi! I want to trasform
[674 631 1 10 144]
in
{'674' '631' '1' '10' '144'},
I have tried to use num2str but it gives me {'674 631 1 10 144'} that is different from that I want as result.
回答 (1 件)
Guillaume
2016 年 3 月 21 日
Two simple options:
1. loop (explicit or with arrayfun):
a = [874 631 1 10 144];
c = arrayfun(@num2str, a, 'UniformOutput', false)
2. Using sprintfc an undocumented function that's been in matlab for a while. Since it's undocumented it may disappear in a future version or may change behaviour
a = [874 631 1 10 144];
c = sprintfc('%d', a)
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!