Filter löschen
Filter löschen

how to convert vector in string as example

1 Ansicht (letzte 30 Tage)
Luca Re
Luca Re am 2 Sep. 2023
Kommentiert: Voss am 2 Sep. 2023
Input: c and a
c=1;
a=[4 7]
"cnt 1 - [4 7]"
c=2;
a=[8 9]
"cnt 2 - [8 9]"

Akzeptierte Antwort

Voss
Voss am 2 Sep. 2023
c=1; 
a=[4 7]
sprintf("cnt %d - [",c) + num2str(a) + "]"
  4 Kommentare
Luca Re
Luca Re am 2 Sep. 2023
thank you
Voss
Voss am 2 Sep. 2023
You're welcome!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

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

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by