Path: news.mathworks.com!not-for-mail
From: "Dan Haeg" <haegd@msoe.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: generate combination set
Date: Thu, 15 Nov 2007 05:18:09 +0000 (UTC)
Organization: Milwaukee School of Engineering
Lines: 17
Message-ID: <fhgkqh$7no$1@fred.mathworks.com>
References: <fhgisb$us$1@fred.mathworks.com>
Reply-To: "Dan Haeg" <haegd@msoe.edu>
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 1195103889 7928 172.30.248.35 (15 Nov 2007 05:18:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 15 Nov 2007 05:18:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 475291
Xref: news.mathworks.com comp.soft-sys.matlab:437621



"Aimin Yan" <aiminy@iastate.edu> wrote in message
<fhgisb$us$1@fred.mathworks.com>...
> I have a set data={A B C D E F G H}
> I want to choose 3 from 8, that is to generate the 
> combination set like this
> combination set={ABC ABD ....}
> Does anyone how to do in matalb
> 
> thanks,
> 
> Aimin  

Is this what you want?

ind=nchoosek(1:8,3);
data={'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H'}
set=data(ind);