For Programmers: Free Programming Magazines  


Home > Archive > Matlab > April 2005 > How to Change Matrix in to single column matrix









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to Change Matrix in to single column matrix
Mahesh Neupane

2005-04-27, 4:03 pm

hello friends...
I have a matrix

A = [ 1 2 3
4 5 6
7 8 9
];

I want to change this matrix into single coloumn format, such as
A = [ 1
2
3
4
5
6
7
8
9
];

Please provide me the proper MATLAB command to do above operation.

Mahesh
us

2005-04-27, 4:03 pm

Mahesh Neupane:
<SNIP wants to reshape his/her mat...

some of the solutions

b=reshape(permute(A,[2 1]),[],1)
% -or-
b=A.';
b=b(:)

others will have better ones
us
us

2005-04-27, 9:01 pm

PB:
<SNIP - as usual - drilling right into the wound...

> ... Just thougt that your recent posts has had a small touch of

obfuscating :)

SMALL?! <PB> (!), it took me such a long time to clandestinely
wrap the obvious!

as usual, best with a big laughter
us
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com