function Y = rownorm01(X,K)
% Y = rownorm(X,K)  normalize each row of X to be zero mean, unit var 
%     If K is present, it has two columns and one row for each row of X; 
%     its first column is the mean and 2nd is the stddev to norm by.
% dpwe@media.mit.edu 1999apr09 after rownorm

[nr,nc] = size(X);
if(nargin < 2)
  K = zeros(nr,2);
  K(:,1) = mean(X')';
  K(:,2) = std(X')';
end

X = X - K(:,1)*ones(1,nc);
Y = X ./ (K(:,2)*ones(1,nc));

