From: Snow White on 18 May 2010 06:23 hello, i have a row vector of length p. i want to transform it to a 3d matrix where the there r 3 row each row should be similar to the previous row (they are just copies). number of columns is pmn where mn is the size of another matrix and the depth of the resultant matrix is p. how can i do this? bye
From: TideMan on 18 May 2010 06:43 On May 18, 10:23 pm, "Snow White" <gulesa...(a)gmail.com> wrote: > hello, > > i have a row vector of length p. i want to transform it to a 3d matrix where the there r 3 row each row should be similar to the previous row (they are just copies). number of columns is pmn where mn is the size of another matrix and the depth of the resultant matrix is p. > > how can i do this? > > bye You can't. The row vector,say R, must be 3*pmn*p long. Then: M=reshape(R,3,pmn,p);
From: Snow White on 18 May 2010 06:59 i tried it as follows a=[1 0] a = 1 0 M=reshape(a,3,2*2*10,2); ??? Error using ==> reshape To RESHAPE the number of elements must not change. and the above error TideMan <mulgor(a)gmail.com> wrote in message <1da1eddd-078d-4a52-88d9-bb02624f1e48(a)g5g2000pre.googlegroups.com>... > On May 18, 10:23 pm, "Snow White" <gulesa...(a)gmail.com> wrote: > > hello, > > > > i have a row vector of length p. i want to transform it to a 3d matrix where the there r 3 row each row should be similar to the previous row (they are just copies). number of columns is pmn where mn is the size of another matrix and the depth of the resultant matrix is p. > > > > how can i do this? > > > > bye > > You can't. > The row vector,say R, must be 3*pmn*p long. > Then: > M=reshape(R,3,pmn,p);
From: Steven Lord on 18 May 2010 09:30 "Snow White" <gulesaman(a)gmail.com> wrote in message news:hstrtq$rkp$1(a)fred.mathworks.com... >i tried it as follows > > a=[1 0] > > a = 1 0 > > M=reshape(a,3,2*2*10,2); > ??? Error using ==> reshape > To RESHAPE the number of elements must not change. > and the above error Yes, as TideMan said that WILL NOT WORK, and the error message you received indicated WHY it doesn't work. What do you expect the result to be when you perform this transformation on a = [1 0]? Perhaps seeing that will give us some insight into what you're trying to do. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
From: Snow White on 18 May 2010 09:53 I want [a] to be arranged such that the resultant matrix has three rows and pmn columns and the depth of the matrix is p which is the length of vector a.so in the third dimension the first dimension will have all ones and then the second will have 0s and so on.. actually i have a vector p=[1,2,3,4,5...19] i hope i cam clear enough "Steven Lord" <slord(a)mathworks.com> wrote in message <hsu4qe$chs$1(a)fred.mathworks.com>... > > "Snow White" <gulesaman(a)gmail.com> wrote in message > news:hstrtq$rkp$1(a)fred.mathworks.com... > >i tried it as follows > > > > a=[1 0] > > > > a = 1 0 > > > > M=reshape(a,3,2*2*10,2); > > ??? Error using ==> reshape > > To RESHAPE the number of elements must not change. > > and the above error > > Yes, as TideMan said that WILL NOT WORK, and the error message you received > indicated WHY it doesn't work. > > What do you expect the result to be when you perform this transformation on > a = [1 0]? Perhaps seeing that will give us some insight into what you're > trying to do. > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ >
|
Next
|
Last
Pages: 1 2 3 Prev: Check caller function Next: normpdf works for very small sigma values? |