From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Pick random lines of a matrix ?
Date: Fri, 16 Apr 2010 18:39:23 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <hqaasr$l31$>
References: <hqa8ha$89u$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1271443163 21601 (16 Apr 2010 18:39:23 GMT)
NNTP-Posting-Date: Fri, 16 Apr 2010 18:39:23 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:627295

"MOUIZINA Ali" <> wrote in message <hqa8ha$89u$>...
> Hello everyone,
> I have a matrix called F (size : 152 4) and i would like to pick randomly 53 lines among the 66 first lines and put them in a new matrix X, then i would like to pick randomly 45 lines among  the 56 next lines of F and put them in X and finally pick randomly 24 lines of the last 30 lines of F and put them also in X.
> So after all these operations, my new matrix X will have 122 lines and 4 rows.
> By the way, i can pick only once each line of F so that i don't have the same lines repeated in X.
> Thank you very much.
> PS:I tried to search on the forum about something similar with no relevant results
> Ali

p1 = randperm(66);
p1 = p1(1:53);
p2 = randperm(56)+66;
p2 = p2(1:45);
p3 = randperm(30)+66+56;
p3 = p3(1:24);
X = F([p1,p2,p3],:);

Roger Stafford