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)
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?

Accepted Answer

Star Strider
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)

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!