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 个)

[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 Exchange 中查找有关 Data 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