Adding matrix values into a string

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?

 Respuesta aceptada

KSSV
KSSV el 2 de Dic. de 2020
a=[1 2 3 4 5 6 7 8 9] ;
str = char(a+'0')
str = '123456789'

3 comentarios

Ilan Kurtser
Ilan Kurtser el 2 de Dic. de 2020
Thank you sir
I edited the question, I meant the 3 first values in the array
a=[1 2 3 4 5 6 7 8 9] ;
str = char(a(1:3)+'0')
str = '123'
Ilan Kurtser
Ilan Kurtser el 2 de Dic. de 2020
Thank you very much!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 2 de Dic. de 2020

Comentada:

el 2 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by