Merging rows of a matrix into a number

1 Ansicht (letzte 30 Tage)
Aleem Andrew
Aleem Andrew am 27 Okt. 2021
Beantwortet: Ive J am 27 Okt. 2021
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 Kommentare
Image Analyst
Image Analyst am 27 Okt. 2021
@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 am 27 Okt. 2021
@Image Analyst sure, tnx!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Ive J
Ive J am 27 Okt. 2021

Weitere Antworten (1)

Jan
Jan am 27 Okt. 2021
Bearbeitet: Jan am 27 Okt. 2021
C = [345
679
158];
D = rem(floor(C ./ [100, 10, 1]), 10)
D = 3×3
3 4 5 6 7 9 1 5 8

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by