How to reshape and rearrange a matrix in a specific way
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
KSSV
on 20 Oct 2020
Edited: KSSV
on 20 Oct 2020
If A is matrix. USe
iwant = A(:)
Example:
A = [0, 0; -0.001, 0; 0, 0.02] ;
A = A' ;
iwant = A(:)
3 Comments
Stephen23
on 20 Oct 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
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!