Azzera filtri
Azzera filtri

how to convert vector in string as example

1 visualizzazione (ultimi 30 giorni)
Luca Re
Luca Re il 2 Set 2023
Commentato: Voss il 2 Set 2023
Input: c and a
c=1;
a=[4 7]
"cnt 1 - [4 7]"
c=2;
a=[8 9]
"cnt 2 - [8 9]"

Risposta accettata

Voss
Voss il 2 Set 2023
c=1; 
a=[4 7]
sprintf("cnt %d - [",c) + num2str(a) + "]"
  4 Commenti

Accedi per commentare.

Più risposte (1)

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

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by