|
"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
|