Path: news.mathworks.com!not-for-mail
From: "helper " <spamless@nospam.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Number of unique combinations from sets
Date: Wed, 7 May 2008 05:05:05 +0000 (UTC)
Organization: Timothy S. Farajian, Inc.
Lines: 68
Message-ID: <fvrda1$s4d$1@fred.mathworks.com>
References: <fvr755$inh$1@fred.mathworks.com> <fvr8v7$h82$1@fred.mathworks.com> <fvrc2j$rtm$1@fred.mathworks.com>
Reply-To: "helper " <spamless@nospam.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210136705 28813 172.30.248.35 (7 May 2008 05:05:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 7 May 2008 05:05:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1272923
Xref: news.mathworks.com comp.soft-sys.matlab:467082


"Daniel " <danielDOTrDOTlittle@gmail.com> wrote in message 
<fvrc2j$rtm$1@fred.mathworks.com>...
> > You are looking for all combinations with replacement.  
> > Check out the file COMBSREP.m at the following link:
> > 
> > http://www.mathworks.com/support/solutions/files/s36265/
> > 
> > combsrep(1:3, 2)
> 
> 'combsrep' will work if the sets I'm comparing are all the
> same, but it lacks the functionality of 'allcomb', which
> allows the sets to contain different elements. 
> 
> So to give another example:
> 
> >> allcomb([1:3], [1:4])
> 
> ans =
> 
>      1     1
>      1     2
>      1     3
>      1     4
>      2     1
>      2     2
>      2     3
>      2     4
>      3     1
>      3     2
>      3     3
>      3     4
> 
> But I need:
> 
> ans =
> 
>      1     1
>      1     2
>      1     3
>      1     4
>      2     2
>      2     3
>      2     4
>      3     3
>      3     4
> 
> I don't think I can do this with combsrep (or am I missing
> something)?
> 
> Thanks for the link though (and thanks to anyone else 
who's
> replied), combsrep looks like a useful function anway. 

I don't understand what you are asking for then.  Your 
first example looked like you were selecting an item from a 
set, replacing it, then selecting again.

In this example, it looks like you have two sets(1:3 and 
1:4), selecting 1 item from each set.  Why is [2 1] not a 
valid combination then?  Are you saying the second set 
changes based on your selection of the first set?  All 
elements of the second set which are smaller than the value 
of your selection in the first set disappear?

I could come up with some code that will do this, but I 
don't think this is really what you want to do.  Maybe you 
can explain further.