merge number and character

hi, how i can merge this x=3 y='-'
when do z=[x y] i get z =
- this symbol is appearing as square in command of matlab i need the result be 3 - how get that?
thanks

 Respuesta aceptada

Walter Roberson
Walter Roberson el 4 de Mayo de 2012

1 voto

You cannot. Anyone one array can be numeric or character, but not both at the same time.
Perhaps you want
z = [num2str(x) y];

Más respuestas (1)

Kye Taylor
Kye Taylor el 4 de Mayo de 2012

1 voto

If
x = 3; y = '-';
merge with
[num2str(x),y]

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by