function r_mat = rnorm(mat,normdim) % Range (0-1) normalization along the first dimension of the matrix if ~exist('normdim','var'),normdim = 'all';end max_mat = nanmax(mat,[],normdim); min_mat = nanmin(mat,[],normdim); % for i = 1:ndims(mat) % max_mat = max(max_mat); % min_mat = min(min_mat); % end r_mat = (mat - min_mat)./(max_mat - min_mat); end