MATLAB: How to find rows of a matrix that have a specific number of values different from NaN

findmatrixnan

Hi, That's my problem: I have a large matrix with 157800 rows and 11 columns, which contains also NaN. I would like to see how many rows of the matrix contain 1,2,3,…,11 values different from NaN. Someone can help me? Thanks

Best Answer

numnans = sum( isnan(YourMatrix), 2);
counts = histc(numnans, 0:11);