the easiest way to convert matrix to one row vector

Posted by niko on Stack Overflow See other posts from Stack Overflow or by niko
Published on 2010-04-28T15:24:50Z Indexed on 2010/04/28 15:33 UTC
Read the original article Hit count: 521

Filed under:
|

Hi,

Does anyone know what is the best way to create one row matrix (vector) from M x N matrix by putting all rows, from 1 to M, of the original matrix into first row of new matrix the following way:

A = [row1; row2, ..., rowM]
B = [row1, row2, ..., rowM]

Example:

A = [1 1 0 0; 0 1 0 1]
B = [1 1 0 0 0 1 0 1]

I would be very thankful if anyone suggested any simple method or perhaps points out a function if it already exists that could generate matrix B from original matrix A.

© Stack Overflow or respective owner

Related posts about matlab

Related posts about matrix