Merging rows of a matrix into a number

1 回表示 (過去 30 日間)
Aleem Andrew
Aleem Andrew 2021 年 10 月 27 日
回答済み: Ive J 2021 年 10 月 27 日
If you have the 3*1 matrix
C = [345
679
158]
and you want to change it to the 3*3 matrix (or vice versa)
C = [3 4 5
6 7 9
1 5 8]
so that you can for example sort it in descending order of the columns, how would you do this? Thank you.
  2 件のコメント
Image Analyst
Image Analyst 2021 年 10 月 27 日
@Ive J, can you put your Answer down below in the Answers section rather than up here in comments that is used to ask the original poster for clarification? You can also get credit for your answer down there if the poster accepts your answer and/or votes for it.
Ive J
Ive J 2021 年 10 月 27 日
@Image Analyst sure, tnx!

サインインしてコメントする。

採用された回答

Ive J
Ive J 2021 年 10 月 27 日

その他の回答 (1 件)

Jan
Jan 2021 年 10 月 27 日
編集済み: Jan 2021 年 10 月 27 日
C = [345
679
158];
D = rem(floor(C ./ [100, 10, 1]), 10)
D = 3×3
3 4 5 6 7 9 1 5 8

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by