From: MOUIZINA Ali on
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
From: Roger Stafford on
"MOUIZINA Ali" <faytstrife(a)hotmail.fr> wrote in message <hqa8ha$89u$1(a)fred.mathworks.com>...
> 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
From: MOUIZINA Ali on
Thank you very much, your code is optimal.