Da: Ben Abbott <address@hidden>
Oggetto: Re: extracting rows in a matrix
A: address@hidden
Cc: address@hidden
Data: Mercoledì 13 maggio 2009, 01:13
On May 12, 2009, at 6:03 PM, Carlo Rossi wrote:
> Hello,
> I have a matrix A 450x10 and I need t extract randomly 1/5 of 500 rows and create with these rows another matrix B.
> Is there any function to do it? Any helps?
>
> thanks,
You can do that in one line, but using "randperm" and Octave's cool method for indexing.
B = A(randperm (size (A, 1)), :)(1:size (A, 1)/5, :);
Ben