yep, this is a good approach..
actually, at first I tried not this, but something like this approach...but as the problem was ocuuring, i gave up and tried this way...but this one is a better one...
Thanks again.
Galib
"us " <us@neurol.unizh.ch> wrote in message <h2a5eh$i5b$1@fred.mathworks.com>...
> "Syed Galib" <galib.cse@gmail.com> wrote in message <h2a3m9$mfo$1@fred.mathworks.com>...
> > "us " <us@neurol.unizh.ch> wrote in message <h2a2s1$iuc$1@fred.mathworks.com>...
> > > "Syed Galib" <galib.cse@gmail.com> wrote in message <h2a25j$pr2$1@fred.mathworks.com>...
> > > > Hello all,
> > > >
> > > > I am sorry to ask you again for another problem, as I am a new MATLab user.
> > > >
> > > > I have a matrix, rAlphaSet with combinations of +1 and 1. I want to make 2 Matrices rAlpha1 and rAlpha2. I took 2 random numbers r1 and r2. Then I wanted to copy the r1th and r2th column of rAlphaSet to rAplha1 and rAlpha2. But the problem is, when I was running the code, rAlpha1 and rAlpha2 were not having the columns from rAlphaSet. Here is the code:
> > > >
> > > > rAlphaSet = (npermutek([1 1], 2^m))';
> > > > rAlpha1 = zeros(2^m,N);
> > > > rAlpha2 = zeros(2^m,N);
> > > >
> > > > for i = 1:N
> > > > r = randi(256,1);
> > > > rAlpha1(:,i) = rAlphaSet(r);
> > > > r = randi(256,1);
> > > > rAlpha2(:,i) = rAlphaSet(r);
> > > > end
> > > >
> > > > Can anybody tell me why this is happening? Please, help me.
> > > >
> > > > Thank you very much in advance.
> > > >
> > > > Regards
> > > > Galib
> > >
> > > a hint:
> > >
> > > % try
> > > % ...
> > > rAlpha1(:,i)= rAlphaSet(:,r);
> > > rAlpha2(:,i)=rAlphaSet(:,r);
> > > % ...
> > >
> > > us
> >
> > Dear Us
> >
> > Thank you very much. It worked.
> >
> > Thanks again.
> >
> > Regards
> > Galib
>
> well, so much for the syntax...
> however, why not use this approach
>
> r=randi(256,[2,N]);
> ra1=ras(:,r(1,:));
> ra2=ras(:,r(2,:));
>
> just a thought...
> us
