Adding matrix values into a string

2 Ansichten (letzte 30 Tage)
Ilan Kurtser
Ilan Kurtser am 2 Dez. 2020
Kommentiert: Ilan Kurtser am 2 Dez. 2020
Hello,
I want to turn a matrix
a=[1 2 3 4 5 6 7 8 9] for say
into a string with the three first values of the array
b=123;
Any ideas how to do it?

Akzeptierte Antwort

KSSV
KSSV am 2 Dez. 2020
a=[1 2 3 4 5 6 7 8 9] ;
str = char(a+'0')
str = '123456789'
  3 Kommentare
KSSV
KSSV am 2 Dez. 2020
a=[1 2 3 4 5 6 7 8 9] ;
str = char(a(1:3)+'0')
str = '123'
Ilan Kurtser
Ilan Kurtser am 2 Dez. 2020
Thank you very much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings 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