max (matrix, DIM) does not behave as advertised

David Bateman dbateman at dbateman.org
Tue Nov 11 11:51:01 CST 2008


Francesco Potortì wrote:
> The help string says:
> 
>  -- Mapping Function:  max (X, Y, DIM)
> 
>      For a matrix
>      argument, return the maximum value from each column, as a row
>      vector, or over the dimension DIM if defined.
> 
> but:
> 
> octave3.1> max(ones(2),2)
> ans =
> 
>    2   2
>    2   2

That is consistent.. I believe you mean

max(ones(2,2),[],2)

> moreover:
> 
> octave3.1> max(ones(2),ones(2),2)
> ans =
> 
>    1   1
>    1   1

Humm, yes that should probably produce an error as you say.

D.


-- 
David Bateman                                dbateman at dbateman.org
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)


More information about the Bug-octave mailing list