Transform rows to columns and add them at the end
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Alexander Bächi
am 14 Apr. 2022
Kommentiert: Mathieu NOE
am 14 Apr. 2022
Hello
I have a matrix like this:
1 2 3
4 5 6
7 8 9
Now, I want to transform it to this:
1
2
3
4
5
6
7
8
9
Note, the real values are not in row, so sort is no option.
Thanks in advance.
0 Kommentare
Akzeptierte Antwort
Mathieu NOE
am 14 Apr. 2022
hi
simply this :
>> a = [1 2 3 ;
4 5 6;
7 8 9];
>> a(:)
ans =
1
4
7
2
5
8
3
6
9
2 Kommentare
Mathieu NOE
am 14 Apr. 2022
oops
this is better :)
a = [1 2 3 ;
4 5 6;
7 8 9];
b = a';
b(:)
ans =
1
2
3
4
5
6
7
8
9
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices 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!