Converting a 10x10 matrix to a 100x1 vector

4 views (last 30 days)
Currently, I have a 10x10 matrix displaying the geometry for a figure. I need to turn that 10x10 into a 100x1 vector for use in solving a linear equation. The order I need for this 100x1 is that the first row of the 10x10 would be 1-10 on the 100x1 vector, second row would be 11-20 etc. How can I do this in MATLAB? I feel like it should be a simple code, but I'm struggling with putting it together. Any help would be appreciated.

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 1 Nov 2013
Edited: Azzi Abdelmalek on 1 Nov 2013
If A is your matrix
B=A';
out=B(:)
%or
out=reshape(A',[],1)
  3 Comments
Azzi Abdelmalek
Azzi Abdelmalek on 1 Nov 2013
Unless you are confusing rows and columns, in this case
out=A(:)

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!