Question about single digits.

Hi everyone. Is there any function that converts "complex" number for example [123] to constituent elements [1 2 3] ?

 Respuesta aceptada

Jonathan Sullivan
Jonathan Sullivan el 13 de Jul. de 2012

1 voto

Its not the most elegant, but this works:
A = str2num(num2str(123)')'

Más respuestas (1)

Artyom
Artyom el 13 de Jul. de 2012

0 votos

Thanks. Maybe you know how to do the reverse process - from [5] [5] to [55]?

2 comentarios

F.
F. el 13 de Jul. de 2012
A = [ 1 2 3 ];
S = sum( A .* ( 10 ^ (numel(A)-1:-1:0 ) ) )
F.
F. el 13 de Jul. de 2012
;-)

Iniciar sesión para comentar.

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