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]

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

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 Aerospace Blockset 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!