% SCALES REAL MATRICES INTO 0 TO 255 (or other) RANGE
%
% Y = scaler2(B);  % scales B to go from 0 to 255
%
% Y = scaler2(B,16) % scales B to go from 0 to 15
% Y = scaler2(B,10) % gives matrix of single digit integers
%
% there is another script file with the name spelled backwards which has
% no comments in it;  strange errors, then use it

function Y = dummy_name(X,levels_per_pixel)

if nargin < 2
  levels_per_pixel = 256;
end%if

minX=min(min(X));
maxX=max(max(X));

Y = round( (X-minX)*(levels_per_pixel-1)/(maxX-minX) );

