[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: extracting rows in a matrix
From: |
Ben Abbott |
Subject: |
Re: extracting rows in a matrix |
Date: |
Tue, 12 May 2009 19:13:00 -0400 |
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