Documentation of findmax


Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)


Function Synopsis

maxind = findmax(x);

Help text


  maxind = findmax(x);

  This function returns the location of the minimum and maximum 
  values in a matrix x.


Cross-Reference Information

This function calls

Listing of function findmax

function maxind = findmax(x);

szx = size(x);
nd = length(szx(szx ~= 1));

maxind = repmat(NaN, [1, nd]);

[minx, maxx] = range(x);
tem1 = x;

if nd > 1;

for i = 1:(nd-1);

  tem1 = reshape(tem1, [szx(i) prod(szx((i+1):nd))]);
 
  maxind(i) = find(max(tem1') == maxx);

  tem1 = tem1(maxind(i), :);

end

end

maxind(nd) = find(tem1 == maxx);