Matrix[1,1,1,1;-1,-1,-1,-1;1,1,1,1] to vector[1,1,1,1,-1,-1,-1,-1,1,1,1,1]
19 views (last 30 days)
Show older comments
DongShin Yang
on 29 Jun 2015
Commented: DongShin Yang
on 29 Jun 2015
Matrix[1,1,1,1;-1,-1,-1,-1;1,1,1,1] to vector[1,1,1,1,-1,-1,-1,-1,1,1,1,1] How can I code?
0 Comments
Accepted Answer
Star Strider
on 29 Jun 2015
Edited: Star Strider
on 29 Jun 2015
I believe you intended semicolons (;) instead of colons (:) in your matrix definition.
To convert it to a vector, use the reshape function:
Matrix = [1,1,1,1; -1,-1,-1,-1; 1,1,1,1];
Vector = reshape(Matrix', 1, [])
Vector =
1 1 1 1 -1 -1 -1 -1 1 1 1 1
EDIT — Added output of ‘Vector’.
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!