help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extracting rows in a matrix


From: Carlo Rossi
Subject: Re: extracting rows in a matrix
Date: Wed, 13 May 2009 14:25:26 +0000 (GMT)

sorry, I was looking that way to do it in a loop. They are matrices with same number of columns but different lines.

--- Mer 13/5/09, Przemek Klosowski <address@hidden> ha scritto:

Da: Przemek Klosowski <address@hidden>
Oggetto: Re: extracting rows in a matrix
A: address@hidden, address@hidden
Data: Mercoledì 13 maggio 2009, 16:10


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

OK, just do the same thing four times, then:

   sz=size(A0,1)
   tmp0=A0(randperm(sz,:);
   tmp1=A1(randperm(sz,:);
   ...
   result=[tmp0(1:sz/5,:),tmp1(1:sz/5,:)...];

However, given a series of data objects named A0, A1, etc., one wonders if
they shouldn't be a single indexed object, either a 3D array or a cell array.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]