Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How can I do this in MATLAB? (Possibilities)
Date: Sun, 1 Feb 2009 05:34:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 29
Message-ID: <gm3c89$7dg$1@fred.mathworks.com>
References: <gm1mkl$eq0$1@fred.mathworks.com> <gm1prp$95f$1@fred.mathworks.com> <gm1rrh$f6e$1@fred.mathworks.com> <gm1t2t$3eh$1@fred.mathworks.com> <gm1u0v$3df$1@fred.mathworks.com> <gm1uut$335$1@fred.mathworks.com> <gm2c2v$t90$1@fred.mathworks.com> <gm2up1$beg$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1233466441 7600 172.30.248.38 (1 Feb 2009 05:34:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 1 Feb 2009 05:34:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1477385
Xref: news.mathworks.com comp.soft-sys.matlab:515217


Matt Fig:
The code works for all choices.
>> m=3

m =
     3

>> n=2

n =
     2

>> output = diff([zeros(nchoosek(m+n,n),1),nchoosek(1:m+n,n)],1,2)-1

output =

     0     0
     0     1
     0     2
     0     3
     1     0
     1     1
     1     2
     2     0
     2     1
     3     0

Roger Stafford:
Thanks for the explanation, I now understand how it works. I didn't get the second paragraph though but I'll reread it and keep trying it out until I do. Thanks a heap!