How to convert a vector to a string (Matlab2016a)

hi everyone,
i want to convert a vector to a string, how can i do it in matlab2016a
for example A = [ 1 2 3]
thanks in advance

回答(1 个)

For what definition of "string"?
>> A=1:3;
>> num2str(A)
ans =
'1 2 3'
>> num2str(A.')
ans =
3×1 char array
'1'
'2'
'3'
>> string(A) % requires R2016b
ans =
1×3 string array
"1" "2" "3"
>>

类别

帮助中心File Exchange 中查找有关 Characters and Strings 的更多信息

产品

版本

R2016a

标签

提问:

2020-12-12

评论:

dpb
2020-12-12

Community Treasure Hunt

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

Start Hunting!

Translated by