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: Sat, 31 Jan 2009 16:25:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 12
Message-ID: <gm1u0v$3df$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>
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 1233419103 3503 172.30.248.38 (31 Jan 2009 16:25:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 31 Jan 2009 16:25:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:515150


"Husam Aldahiyat" <numandina@gmail.com> wrote in message <gm1t2t$3eh$1@fred.mathworks.com>...
> Roger Stafford:
> Code still doesn't work.
> ......

  Yes, you are quite right, Husam.  I didn't use 'diff' correctly.  It is intended to operate on the rows from 'nchoosek'.  Try this:

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

  And as I mentioned, you might need to use the sort, though I suspect not.

Roger Stafford