function data_s= scale_matrix2(data, range)
% scale_matrix2 scales a matrix into [0 1] or a range specified by range
%
% Usage:
% data_s= scale_matrix2(data, range);
%data_s= scale_matrix2(data);
%
% Wenbin, 28-Jul-2009
if nargin ==1
range =[0 1];
end
data_c =data(:);
data_s =(data-min(data_c))./(max(data_c) -min(data_c)).*(range(2) -range(1)) +range(1);
No comments:
Post a Comment