how to convert vector in string as example

2 次查看(过去 30 天)
Input: c and a
c=1;
a=[4 7]
"cnt 1 - [4 7]"
c=2;
a=[8 9]
"cnt 2 - [8 9]"

采纳的回答

Voss
Voss 2023-9-2
c=1; 
a=[4 7]
sprintf("cnt %d - [",c) + num2str(a) + "]"
  4 个评论

请先登录,再进行评论。

更多回答(1 个)

Alexander
Alexander 2023-9-2
My solution:
c=1;
a=[4 7]
resultTxT =['"cnt ' num2str(c) ' - [' num2str(a) ']"']

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by