function theMax = yetAnotherMax(v) % yetAnotherMax return maximum value in a vector (a different way) % % consumes: v, a vector % produces: theMax, a scalar, the maximum value in v % % Example: % >> myMax([3 5 6 2]) % ans = % 6 % >> myMax([]) % ans = % [] % % P. Conrad for CISC106, sect 99, 10/22/2007 if (isempty(v)) theMax = []; else theMax = v(1); for e=v % e takes on the value of each successive element if (e > theMax) theMax = e; end; % if end; % for end % if return; end % function