Rank: 4873 based on 2 downloads (last 30 days) and 2 files submitted
photo

Andreas Hoechner

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by Andreas View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
30 Jan 2008 indmax Finds maximum and its index of an N-dimensional array. Author: Andreas Hoechner max, indmax, cell array, ndimensional, index 1 3
20 Aug 2007 catdim Unconcatenate array and catenate along other dimension. Author: Andreas Hoechner matrices, cat, concatenate, reshape, uncat 1 0
Comments and Ratings on Andreas' Files View all
Updated File Comment by Comments Rating
06 Feb 2008 indmax Finds maximum and its index of an N-dimensional array. Author: Andreas Hoechner Hoechner, Andreas

dear w s

'So the function should rather be termed submax.'
-yes

'Wouldn't it be better that all indices or subscripts are returned where A==max(A)?' -sometimes, in my case not...

Wouldn't it be better to return them as row vector?'
- not necessarily. and the syntax (see example) is not maximum=A(ind) but maximum=A(ind{:})

anyway, i thought the recursive loop was quite elegant, but of course, using the linear index is faster and easier. i was not aware of maxn by douane hanselman and recommend to use his routine.

30 Jan 2008 indmax Finds maximum and its index of an N-dimensional array. Author: Andreas Hoechner Hanselman, Duane

For an alternative see the functions minn and maxn, file id # 4719, on the File Exchange

30 Jan 2008 indmax Finds maximum and its index of an N-dimensional array. Author: Andreas Hoechner s, w

Some comments and questions:

indmax finds the subscripts and not single index. So the function should rather be termed submax.

indmax returns only the first occurrence of max(A). Wouldn't it be better that all indices or subscripts are returned where A==max(A)?

indmax returns the indices (subscripts) as cell array. Wouldn't it be better to return them as row vector? Because this here (taken from your example) returns an error.

A = cat(3,magic(4),flipud(magic(4)+1));
[ind,maxi]=indmax(A)

ind =

    [4] [1] [2]

maxi =

    17

maximum = A(ind)

??? Error using ==> subsindex
Function 'subsindex' is not defined for values of class 'cell'.

Top Tags Applied by Andreas
cell array, index, indmax, matrices, max
Files Tagged by Andreas View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
30 Jan 2008 indmax Finds maximum and its index of an N-dimensional array. Author: Andreas Hoechner max, indmax, cell array, ndimensional, index 1 3
20 Aug 2007 catdim Unconcatenate array and catenate along other dimension. Author: Andreas Hoechner matrices, cat, concatenate, reshape, uncat 1 0

Contact us at files@mathworks.com