


maxxy: Maximum of a matrix
Usage: [maxValue, maxIndex] = maxxy(A)
maxValue: the maximum of the matrix A
maxIndex: the 2D index of maxValue in A
For example:
[maxValue, maxIndex]=maxXy(magic(5))

0001 function [maxValue, maxIndex] = maxXy(mat) 0002 %maxxy: Maximum of a matrix 0003 % Usage: [maxValue, maxIndex] = maxxy(A) 0004 % maxValue: the maximum of the matrix A 0005 % maxIndex: the 2D index of maxValue in A 0006 % 0007 % For example: 0008 % [maxValue, maxIndex]=maxXy(magic(5)) 0009 0010 % Roger Jang, 20010219, 20071009 0011 0012 [colMax, colMaxIndex] = max(mat); 0013 [maxValue, tmp] = max(colMax); 0014 maxIndex = [colMaxIndex(tmp) tmp];