Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: NchooseK
Date: Wed, 10 Mar 2010 01:31:49 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 17
Message-ID: <hn6sq5$g3s$1@fred.mathworks.com>
References: <hn6mt9$9kb$1@fred.mathworks.com> <hn6nra$8rc$1@fred.mathworks.com> <hn6pst$d24$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1268184709 16508 172.30.248.35 (10 Mar 2010 01:31:49 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 10 Mar 2010 01:31:49 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:615472


"Frank Sabouri" <Frank.Sabouri@gmail.com> wrote in message <hn6pst$d24$1@fred.mathworks.com>...
> Hello -
> 
> Let me ask my question in other way: I have a matrix of data (140X15), I want to randomly generate as much as possible sub-matrices (6X15). It was why I used "nchoosek" to randomly set the sub-matices. There is any function that allow me to creat these submatices.
> 
> Frank

  If what you mean is that you want to randomly select a single set of 6 rows out of 140 rows of a matrix as a submatrix, then what you need is 'randperm', not 'nchoosek'.  The latter would give you all possible such choices, which is an awful lot of choices, namely 9,381,724,380 of them.  

  For a single submatrix:

 p = randperm(140);
 submatrix = matrix(p(1:6),:);

(If you need many such submatrices, repeat the above.  If you are worried about the very remote chance of repetitions, test for and reject them.)

Roger Stafford