Question about single digits.

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

 채택된 답변

Jonathan Sullivan
Jonathan Sullivan 2012년 7월 13일

1 개 추천

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

추가 답변 (1개)

Artyom
Artyom 2012년 7월 13일

0 개 추천

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

댓글 수: 2

F.
F. 2012년 7월 13일
A = [ 1 2 3 ];
S = sum( A .* ( 10 ^ (numel(A)-1:-1:0 ) ) )
F.
F. 2012년 7월 13일
;-)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by