annotate general/numerical/map01.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
rev   line source
samer@4 1 function x=map01(x,dim)
samer@4 2 % map01 - Map values into the range [0,1].
samer@4 3 %
samer@4 4 % map01 :: [Size], D:natural -> [Size].
samer@4 5
samer@4 6 if nargin<2,
samer@4 7 sz=size(x);
samer@4 8 dims=find(sz>1);
samer@4 9 if isempty(dims), dim=1; else dim=dims(1); end
samer@4 10 end
samer@4 11
samer@4 12 x=divnorm(@(z)max(z,[],dim),addnorm(@(y)min(y,[],dim),x));
samer@4 13