Path: news.mathworks.com!not-for-mail
From: "Daniel " <danielDOTrDOTlittle@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Number of unique combinations from sets
Date: Wed, 7 May 2008 04:44:03 +0000 (UTC)
Organization: University of Western Australia
Lines: 49
Message-ID: <fvrc2j$rtm$1@fred.mathworks.com>
References: <fvr755$inh$1@fred.mathworks.com> <fvr8v7$h82$1@fred.mathworks.com>
Reply-To: "Daniel " <danielDOTrDOTlittle@gmail.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 1210135443 28598 172.30.248.35 (7 May 2008 04:44:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 7 May 2008 04:44:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 740978
Xref: news.mathworks.com comp.soft-sys.matlab:467077


> 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.