help-octave
[Top][All Lists]
Advanced

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

Re: loop


From: Jaroslav Hajek
Subject: Re: loop
Date: Thu, 4 Jun 2009 21:13:50 +0200

On Thu, Jun 4, 2009 at 8:58 PM, Carlo Rossi <address@hidden> wrote:
>
> 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,
>

If for some reason you need just a single line, you can separate the
statements using a semicolon.
If you are actually asking whether there is some magical syntax in
Octave for every combination of operations you can think of, then the
answer is no.

regards

-- 
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]