function GRAYSCALED=grayscale(MATRIX)

% Returns a matrix whose entries have been lineary
% stretched between the initial minimum and maximum
% entries, in order to occupy the whole gray scale,
% from 0 to 255.
%
% EXAMPLE:
%
% >> GRAYSCALED=grayscale(MATRIX)


M=max(max(MATRIX));
m=min(min(MATRIX));

GRAYSCALED=255/(M-m)*(MATRIX-m);