extracting rows in a matrix

Carlo Rossi serosole at yahoo.it
Wed May 13 08:50:12 CDT 2009


this is better and it's ok thanks. But suppoing I have 4 matrices; and
i need to pick 1/5 of each of them; and put the result into one matrix;
how can I do it with a loop; the name of matrix are: A0, A1, A2, A3. I
don't know if this name convenction can help



thank you


--- Mer 13/5/09, John W. Eaton <jwe at octave.org> ha scritto:

Da: John W. Eaton <jwe at octave.org>
Oggetto: Re: extracting rows in a matrix
A: "Carlo Rossi" <serosole at yahoo.it>
Cc: "Ben Abbott" <bpabbott at mac.com>, help-octave at octave.org
Data: Mercoledì 13 maggio 2009, 15:27

On 13-May-2009, Carlo Rossi wrote:

| this is very cool but actually I need to write something that is good
| for Matlab too; and I notice only now that it doens't work in Matlab

| B = A(randperm (size (A, 1)), :)(1:size (A, 1)/5, :);

Then write it like this:

  tmp = A(randperm (size (A, 1)), :);
  B = tmp(1:size (A, 1)/5, :);

jwe



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20090513/0c2e3d40/attachment.html 


More information about the Help-octave mailing list