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:41:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <gm1uut$335$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>
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 1233420061 3173 172.30.248.38 (31 Jan 2009 16:41:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 31 Jan 2009 16:41:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1477385
Xref: news.mathworks.com comp.soft-sys.matlab:515153


"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gm1u0v$3df$1@fred.mathworks.com>...
> "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

Amazing. I can't believe you write codes from your mind without testing them.
This is what I was *really* looking for, thanks!