How to reshape a n x m matrix into n*m,1 matrix?
Show older comments
For example I have a matrix B with n=3,m=7
B =[ 0 0 0 0 0 0 -100;
0 0 0 0 0 0 -100;
0 0 0 0 0 0 -100;]
I want to reshape it to n*m,1 (21,1)
B = [0; 0; 0; 0; 0; 0; -100; 0; 0; 0; 0; 0; 0; -100; 0; 0; 0; 0; 0; 0; -100;];
I tried using reshape(B,21,1) or reshape(B,[],1) or reshape(B,[21,1]) but it converts it into
B = [0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; -100; -100; -100;];
Accepted Answer
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!