view general/numerical/mmax.m @ 4:e44f49929e56

Adding reorganised general toolbox, now in several subdirectories.
author samer
date Sat, 12 Jan 2013 19:21:22 +0000
parents
children
line wrap: on
line source
function [t,i,j]=mmax(A)
% mmax - maximum over both dimensions
%
% mmax :: [[N,M]-A] -> A, 1..N, 1..M.

if nargout==1, t=max(A(:));
else
	[t1,i1]=max(A,[],1);
	[t2,i2]=max(t1,[],2);
	t=t2;
	if nargout==3, i=i1(i2); j=i2; 
	elseif nargout==2, i=[i1(i2) i2]; end
end