Sign in

username:

password:



Not a member?

Search matlab



Search tips

Subscribe to matlab



matlab by Keywords

Atanh | Autocorrelation | Bandpass Filter | C++ | Conv | Database | Deconv | Excel | FFT | Filter | Filtering | FIR | Fourier Transfrom | FSK | Gaussian Noise | Haykin | IFFT | Image | Java | LFSR | LMS | LPC | MEX | OFDM | QPSK | Radix | Random | Sampling | Segmentation | Simulink | Visual Basic | Waveform | Wavelet

Discussion Groups

Discussion Groups | Matlab DSP | How to convert vector to matrix ?

Technical discussion about Matlab and issues related to Digital Signal Processing.

  

Post a new Thread

How to convert vector to matrix ? - fetahl2005 - May 18 8:27:18 2008



 Hello 
 By using  reshape function , we can covert matrix to vector(row or 
col.) :
  My question is to convert vector(row /col) to martix. 
  Thanks in advance
  Abu



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: How to convert vector to matrix ? - Pilar Gonzalez-Blanco - May 18 21:13:08 2008

--- In m...@yahoogroups.com, "fetahl2005" <fetahl2005@...> wrote:
>
>  Hello 
>  By using  reshape function , we can covert matrix to vector(row 
or 
> col.) :
>   My question is to convert vector(row /col) to martix. 
>   Thanks in advance
>   Abu
>

Hi,

I think you can also use reshape.
The command reshape(x,M,N), convert a vector o matrix x to another 
matrix of dimension MxN

Example:

>> x=[1 2 3 4]

x =

     1     2     3     4

>> reshape(x,2,2)

ans =

     1     3
     2     4
Hope it helps,

Pilar


(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: How to convert vector to matrix ? - luis...@yahoo.com - May 18 21:13:53 2008

Abu,

you can use function RESHAPE to convert vector to matrix. For example, if A is a 1 x mn vector,
you can generate a m x n matrix by writing:

 B = reshape(A,m,n)

Best regards.

 Hello 
> By using  reshape function , we can covert matrix to vector(row or 
>col.) :
>  My question is to convert vector(row /col) to martix. 
>  Thanks in advance
>  Abu



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re:How to convert vector to matrix ? - Farrukh Aziz - May 20 7:35:34 2008

suppose u have a row vector
   
  V=[1 2 3 4 5 6 7 8 9];
   
  c1=V(1:3);
  c2=V(4:6);
  c3=V(7:9);
   
  cmat=vertcat(c1,c2,c3)    % vertical concatenating the rows to form 3 into 3 matrix
   
  r1=reshape(c1,3,1);
  r2=reshape(c2,3,1);
  r3=reshape(c3,3,1);
   
  rmat=horzcat(r1,r2,r3)     %horizontal concatenation of cols



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )