
function [mv,mx,my] = max2(x)
% [mv,mx,my] = max2(x)
% Find the max value and its position of a data matrix 
% Output:
% mv: maximum value;
% mx, my: x, y coordinates of the maximum
% By Yi-Ou Li Apr. 2005

[mv,mx] = max(x);
[mv,my] = max(mv);
mx = mx(my);
