extracting rows in a matrix
Francesco Potorti`
Potorti at isti.cnr.it
Wed May 13 01:12:28 CDT 2009
> it doesn't work:
>octave:16> extract_row = rand(nrows,1) < 0.2
>extract_row =
>
> 0
> 0
> 0
> 0
> 0
>
>octave:17> B = A(extract_row, :)
>B = [](0x4)
It does work. You chose nrows=5, which in many cases gives you a choice
of zero rows, as in this particular case. Try many times with nrows=5,
and look at the results. Also, try with a bigger nrows.
--
Francesco Potortì (ricercatore) Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR Fax: +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa Email: Potorti at isti.cnr.it
(entrance 20, 1st floor, room C71) Web: http://fly.isti.cnr.it/
More information about the Help-octave
mailing list