MATLAB: How to count non nan values

matrix arraymatrix manipulationvectors

Sir in a vector of large dimension say (750,1) which has NaNs as well as some values. I want to count the non nan values. would you please help me

Best Answer

nnz(~isnan(vec))
where vec is the vector (it could even be a matrix or ND array).