function out=scale(in,lo,hi)
% Usage:: out=scale(in,lo,hi)
% scales the values of in so lo=>0 and hi=>1 and 0<=out<=1.

out=in;
out((out<lo))=lo;
out((out>hi))=hi;
out=(out-lo)./(hi-lo);