Technical discussion about Matlab and issues related to Digital Signal Processing.
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
--- 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
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
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