view general/numerical/mmax.m @ 6:0ce3c2070089

Removed duplicate code and fixed doc in timed_action.
author samer
date Mon, 14 Jan 2013 14:33:37 +0000
parents e44f49929e56
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