|
"galib " <galib.cse@gmail.com> wrote in message <i6k5cs$9kd$1@fred.mathworks.com>...
> "Ross W" <rosswoodskiwi@hotmail.com> wrote in message <i6k4s1$5vg$1@fred.mathworks.com>...
> > "galib " <galib.cse@gmail.com> wrote in message <i6k29i$kjd$1@fred.mathworks.com>...
> > > ImageAnalyst <imageanalyst@mailinator.com> wrote in message <79e8ed63-d592-416e-baa2-4e22d9e336c8@k11g2000vbf.googlegroups.com>...
> > > > Galib:
> > > > Run this little example:
> > > >
> > > > LH = [56 128 97]
> > > > allComb = [56 128 97; 56 97 128; 128 56 97;...
> > > > 128 96 56; 97 56 128; 97 128 56]
> > > > [c rowNumber] = intersect(allComb, LH, 'rows')
> > > >
> > > > LH2 = [97 56 128]
> > > > [c rowNumber] = intersect(allComb, LH2, 'rows')
> > >
> > > Hi ImageAnalyst,
> > >
> > > Thanks for your reply. The problem is, in my case allcomb is as follows:
> > > allcomb = [20 20 20;20 20 21; 20 20 22; ....; 20 20 320; 20 21 20; 20 21 21;...;320 320 320]
> > > So, I need to locate that LH in the all possible combinations of 3 numbers between 20 and 320. I have the nextperm or nextstring function from the FEX, but they generate permutations from 1 to N one by one. But I need from 20 to 320, 3 numbers at a time, 1 by 1.
> > > Could you or anybody else please help in this regard.
> > >
> > > Thanks.
> > >
> > > Galib
> >
> > Hi
> >
> > How about NCHOOSEK? See http://www.mathworks.com/matlabcentral/fileexchange/24325-combinator-combinations-and-permutations
> >
> > Ross
>
> Hi Ross,
>
> Thanks for the reply. NCHOOSEK gives you the non-repeating combinations. And also, myproblem is I am getting "out of memory" problem as I need the whole permutation set of 3 out of the 300 (from 20 to 320) numbers as I need to locate my sequence in the whole set. So...
>
> Anyway, Thanks again. If you have any other idea, please, let me know..
>
> Galib
Hi
So how about VChooseKRO? It allows repetitions and all possible orders.
http://www.mathworks.com/matlabcentral/fileexchange/26242
>> tic;size(VChooseKRO(20:320, 3)),toc
ans =
27270901 3
Elapsed time is 0.608145 seconds.
(it was slower the first time I tried, while it allocated the memory)
Ross
|