Hi

yes,

1- if you have a 2d matrix y so you can write** x = y ( :
) ;**

2- You can use more general command which is **reshape.
**search in matlab help on it.

George

*worldtranquility <w...@yahoo.com>* a
rit:

`Hi all,`

I would like to know if there is a
MATLAB function for converting a 2D

matrix to a vector (ie, append all the
elements of the rows at the end

of the first one)so that a MxN matrix is
converted into a MNx1 or 1xMN

vector.

Thanks

Warm Regards

Ciao.

`NEW! You can now post a message or
access and search the archives of this group on DSPRelated.com:`

http://www.dsprelated.com/groups/matlab/1.php

_____________________________________

Note: If you do a simple "reply"
with your email client, only the author of this message will receive your
answer. You need to do a "reply all" if you want your answer to be
distributed to the entire group.

_____________________________________

About this discussion group:

Archives: http://www.dsprelated.com/groups/matlab/1.php

To Post: Send an email to m...@yahoogroups.com

Other DSP
Related Groups: http://www.dsprelated.com/groups.php

Douvrez le nouveau

Dear Ciao:

test this way:

>>[M,N]=size(A);

>> AR =
reshape(A',1,M*N)

Best regards

Henry

Date:
Thu, 05 May 2005 22:14:33 -0000

From: "worldtranquility"
<w...@yahoo.com>

Subject: Matrix to Vector

Hi all,

I would like to know if there is a MATLAB function for converting
a 2D

matrix to a vector (ie, append all the elements of the rows at the
end

of the first one)so that a MxN matrix is converted into a MNx1 or 1xMN

vector.

Thanks

Warm Regards

Ciao.

Dear Ciao:

test this way:

>>[M,N]=size(A);

>> AR =
reshape(A',1,M*N)

Or you can use this new function because
reshape is a built-in function and you can not see the code.

function vect= mat2vec(A)

[M,N]=size(A);

L=M*N;

for i=1:M

vect(i*N-N+1:i*N)=A(i,:);

end

Best regards

Henry

Date:
Thu, 05 May 2005 22:14:33 -0000

From: "worldtranquility"
<w...@yahoo.com>

Subject: Matrix to Vector

Hi all,

I would like to know if there is a MATLAB function for converting
a 2D

matrix to a vector (ie, append all the elements of the rows at the
end

of the first one)so that a MxN matrix is converted into a MNx1 or 1xMN

vector.

Thanks

Warm Regards

Ciao.