knowledge-database (beta)

Current group: comp.soft-sys.matlab

convert matrix to vectors or vectors to matrix

convert matrix to vectors or vectors to matrix  
Carine Simon
 Re: convert matrix to vectors or vectors to matrix  
Dan Hensley
 Re: convert matrix to vectors or vectors to matrix  
Anders Björk
 Re: convert matrix to vectors or vectors to matrix  
Johan Carlson
From:Carine Simon
Subject:convert matrix to vectors or vectors to matrix
Date:Sun, 23 Jan 2005 14:27:26 -0500
Hi,
I wanted to know if there were built-in Matlab functions to do that?

Thanks a lot,

Carine
From:Dan Hensley
Subject:Re: convert matrix to vectors or vectors to matrix
Date:Sun, 23 Jan 2005 12:36:07 -0700
On Sun, 23 Jan 2005 14:27:26 -0500, Carine Simon wrote:

> Hi,
> I wanted to know if there were built-in Matlab functions to do that?
>
> Thanks a lot,
>
> Carine

help reshape

Dan
From:Anders Björk
Subject:Re: convert matrix to vectors or vectors to matrix
Date:Sun, 23 Jan 2005 20:57:28 +0100
Yes it has

% Some examples
Matrix=randn(10,15);
Vector=Matrix(:);
Vector=reshape(Matrix,10*15,1);
or use
Matrix=reshape(Vector,10,15);

To repate values use repmat

BR
Anders
"Carine Simon" skrev i meddelandet
news:eef96aa.-1@webx.raydaftYaTP...
> Hi,
> I wanted to know if there were built-in Matlab functions to do that?
>
> Thanks a lot,
>
> Carine
From:Johan Carlson
Subject:Re: convert matrix to vectors or vectors to matrix
Date:Sun, 23 Jan 2005 20:41:10 +0100
Carine Simon wrote:
> Hi,
> I wanted to know if there were built-in Matlab functions to do that?
>
> Thanks a lot,
>
> Carine

To convert a matrix A to a vector, simply type
A(:)

For more general conversion, check the reshape function

/Johan
   

Copyright © 2006 knowledge-database   -   All rights reserved