Question about single digits.

1 vue (au cours des 30 derniers jours)
Artyom
Artyom le 13 Juil 2012
Hi everyone. Is there any function that converts "complex" number for example [123] to constituent elements [1 2 3] ?

Réponse acceptée

Jonathan Sullivan
Jonathan Sullivan le 13 Juil 2012
Its not the most elegant, but this works:
A = str2num(num2str(123)')'

Plus de réponses (1)

Artyom
Artyom le 13 Juil 2012
Thanks. Maybe you know how to do the reverse process - from [5] [5] to [55]?
  2 commentaires
F.
F. le 13 Juil 2012
A = [ 1 2 3 ];
S = sum( A .* ( 10 ^ (numel(A)-1:-1:0 ) ) )
F.
F. le 13 Juil 2012
;-)

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by