Form strings/numbers from matrix

Hello,
Looking for a way to join the horizontal elements of a matrix into a number.
[1 2 0; 0 2 6; 9 8 0; 0 0 2] to form [120; 026; 980; 002]
or {120,026,980,002}
Thanks

 채택된 답변

Cedric
Cedric 2013년 3월 31일
편집: Cedric 2013년 3월 31일

1 개 추천

If you want numbers:
>> A = [1 2 0; 0 2 6; 9 8 0; 0 0 2]
A =
1 2 0
0 2 6
9 8 0
0 0 2
>> A * [100;10;1]
ans =
120
26
980
2
and you can convert to string from there if needed.

추가 답변 (0개)

카테고리

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

질문:

2013년 3월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by