MATLAB: How to copy rows of a matrix to convert it into single row?

converting matrix into a row

Suppose I have got A=[1 2; 3 4; 5 6; 7 8]
Now I want output as B=[1 2 3 4 5 6 7 8]
How to do this?
Thanx

Best Answer

Use the reshape function:
A=[1 2; 3 4; 5 6; 7 8];
B = reshape(A', 1, [])
B =
1 2 3 4 5 6 7 8