help-octave
[Top][All Lists]
Advanced

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

Re: loop


From: Carlo Rossi
Subject: Re: loop
Date: Thu, 4 Jun 2009 18:58:42 +0000 (GMT)

I wrote this:
[cc, pp] = max (counting, [], 2);

pp will contains the indexes of columns of matrix (counting is a matrix) with 
the maximun values;

counting = [  2 2 1;
              0 0 1;
              1 0 4;
];

with [cc, pp] = max (counting, [], 2);
I'll have:
 cc = [2; 1; 4]
 pp = [1; 3; 3 ]
I need to change pp in this way:

pp = [ 0  2  2 ];

i.e. pp-1 and traspose it (as before was a column vector)

is it possible achieve it in this line:

 [cc, pp] = max (counting, [], 2);

without do:
 pp = (pp-1)'

thanks,


--- Gio 4/6/09, Jaroslav Hajek <address@hidden> ha scritto:

> Da: Jaroslav Hajek <address@hidden>
> Oggetto: Re: loop
> A: "Carlo Rossi" <address@hidden>
> Cc: address@hidden
> Data: Giovedì 4 giugno 2009, 20:41
> On Thu, Jun 4, 2009 at 3:55 PM, Carlo
> Rossi <address@hidden>
> wrote:
> >
> >> There was a typo, sorry:
> >> [cc, pp] = max (counting, [], 2);
> >
> > Hi, Ifinally understand this. Anyway I need the
> indexes (I suppose pp) in this way:
> >
> >
> > (indexes')-1
> >
> > is there a way to do all in:
> >  [cc, pp] = max (counting, [], 2);
> >
> > Actaully I need only the indexes (pp) not the
> values..
> > thansk,
> >
> >
> 
> I really don't understand what you want. Try explaining
> your problem
> in a more detailed way.
> 
> cheers
> 
> -- 
> RNDr. Jaroslav Hajek
> computing expert & GNU Octave developer
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz
> 


      




reply via email to

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