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 ExchangeMATLAB Mobile Fundamentals についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by