How to reshape and rearrange a matrix in a specific way
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Cathal White
am 20 Okt. 2020
Kommentiert: Stephen23
am 20 Okt. 2020
How can I rearrange the following 3x2 matrix: [0, 0; -0.001, 0; 0, 0.02]
to look like this 6x1: [0; 0; -0.001; 0; 0; 0.02]?
I've tried the reshape function but think I'm using the wrong arguments. Thanks.
0 Kommentare
Akzeptierte Antwort
KSSV
am 20 Okt. 2020
Bearbeitet: KSSV
am 20 Okt. 2020
If A is matrix. USe
iwant = A(:)
Example:
A = [0, 0; -0.001, 0; 0, 0.02] ;
A = A' ;
iwant = A(:)
3 Kommentare
Stephen23
am 20 Okt. 2020
Rather than using complex conjugate transpose, it is better to use transpose:
>> A = [0, 0; -0.001, 0; 0, 0.02]
A =
0.0000 0.0000
-0.0010 0.0000
0.0000 0.0200
>> B = A.';
>> B = B(:)
B =
0.0000
0.0000
-0.0010
0.0000
0.0000
0.0200
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating 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!