How to convert a vector to a string (Matlab2016a)

51 ビュー (過去 30 日間)
Sara
Sara 2020 年 12 月 12 日
コメント済み: dpb 2020 年 12 月 12 日
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 件)

dpb
dpb 2020 年 12 月 12 日
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"
>>
  1 件のコメント
dpb
dpb 2020 年 12 月 12 日
That's what my comment noted...

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by