loop

Michael Grossbach michael at grossbach.org
Thu Jun 4 07:36:39 CDT 2009


Carlo Rossi wrote:
> Sorry, I'm a very newbie. the code isn't work
> 
> ??? Error using ==> max
> MAX with two matrices to compare and two output arguments is not supported.
> 
> anyway I don't understand what you trying to do with the '2' and the 'cc'
> 
> thanks,
> 
> --- Gio 4/6/09, Jaroslav Hajek <highegg at gmail.com> ha scritto:
> 
>> Da: Jaroslav Hajek <highegg at gmail.com>
>> Oggetto: Re: loop
>> A: "Carlo Rossi" <serosole at yahoo.it>
>> Cc: help-octave at octave.org
>> Data: Giovedì 4 giugno 2009, 07:14
>> On Thu, Jun 4, 2009 at 2:53 AM, Carlo
>> Rossi <serosole at yahoo.it>
>> wrote:
>>> Hello,
>>>  I need to write this:
>>>
>>>      for z=1 : size (counting,1)
>>>        cl = find ( counting(z,:) ==
>> max(counting(z,:)));
>>>        pp = [pp; cl(1) ];
>>>      end
>>>
>>> I'm looking for something more compat. Is there?
>>> For example is there a way to avoid to write the "for
>> z=1 : size....."
>>> thanks,
>>>
>>>
>> [cc, pp] = max (counting, 2);
>>
>> sometimes I wonder why we actually bother with docs :)
>>

As Jaroslav suggested: read the manual!
Type 'help max' (without the quotes) at the Octave prompt.

Michael




More information about the Help-octave mailing list