Convert string form to array form on Matlab

How to convert string form into array and from array to string on Matlab?
exam : '1234' ---> [1 2 3 4]
[1 2 3 4] --> '1234'

回答 (2 件)

madhan ravi
madhan ravi 2019 年 5 月 29 日

0 投票

sprintf('%d',1234)
str2double('1234')
Jan
Jan 2019 年 5 月 29 日

0 投票

[1 2 3 4] --> '1234' :
x = [1,2,3,4]
s = sprintf('%d', x)
'1234' ---> [1 2 3 4] :
s = '1234';
x = s - '0'

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

質問済み:

2019 年 5 月 29 日

回答済み:

Jan
2019 年 5 月 29 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by