rnorm.m 360 B

1234567891011
  1. function r_mat = rnorm(mat,normdim)
  2. % Range (0-1) normalization along the first dimension of the matrix
  3. if ~exist('normdim','var'),normdim = 'all';end
  4. max_mat = nanmax(mat,[],normdim);
  5. min_mat = nanmin(mat,[],normdim);
  6. % for i = 1:ndims(mat)
  7. % max_mat = max(max_mat);
  8. % min_mat = min(min_mat);
  9. % end
  10. r_mat = (mat - min_mat)./(max_mat - min_mat);
  11. end