if CONT contains NaNs, zscore function returns an vector of NaNs.
To deal with this case, I propose:
tmp = CONT(CAT==cat_index(n));
if ~any(isnan(tmp)) %if not any NaN in the vector
tmp = zscore(tmp);
else
mu = nanmean(tmp);
sigma = nanstd(tmp);
tmp = (tmp-mu)./sigma;
end
line 73:
tmp = zscore(CONT(CAT==cat_index(n)));
if CONT contains NaNs, zscore function returns an vector of NaNs. To deal with this case, I propose: