Zscore a matrix with NaN
Show older comments
I have matrix A, and I need to find a zscore value (with the intention of running a PCA) of a matrix that has NaN values. I need to have matlab ignore the NaNs while solving for the zscore value. How can I do this? I tried Zscore = zscore(~isnan(A)) but it didn't work.
Thanks for your help!
Accepted Answer
More Answers (1)
jkr
on 21 Jun 2017
5 votes
A simple approach for a vector 'x':
zscore = (x - nanmean(x))/nanstd(x);
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!