Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: -extract 120X9 matrix from 1000X9 matrix randomly
Date: Tue, 9 Feb 2010 16:38:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <hks31c$82t$1@fred.mathworks.com>
References: <hks11k$ti$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 1265733484 8285 172.30.248.35 (9 Feb 2010 16:38:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 9 Feb 2010 16:38:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1931702
Xref: news.mathworks.com comp.soft-sys.matlab:605801


"muk " <hungocan@hotmail.com> wrote in message 
> Now, i have 1000X9 matrix which is quality parameters. And, i want to extract 120X9 matris randomly from 1000x9 matrix.

Do you mean:
a.) You want to randomly choose a 120x9 BLOCK from the bigger matrix, or
b.) You want to randomly choose 120*9 = 1080 elements from the big matrix?

For a:

>> big_matrix = ones([1000 9]); % or whatever data
>> starting_row = ceil(881*rand);
>> ending_row = starting_row + 119;
>> small_matrix = big_matrix(starting_row:ending_row,:);

For b:

>> big_matrix = ones([1000 9]);
>> small_matrix = reshape(big_matrix(ceil(1000*rand([1080 1]))), [120 9]);

You should of course worry about seeding the random number generator.