MATLAB: Estimate length with out NaN’s

length estimationMATLABnan

Hello
I use the length command to see the length of some of my variables, although they include NaN's inside by a previous script I used so as to fill them and compare them Is there a way to find the length of the data non-taking into account the NaN?
I tried nanlength , as you can use nanmean etc. although it does not like it
it gives me this error
Undefined function 'nanlength' for input arguments of type 'double'.

Best Answer

This works:
nonan_len = length(x(~isnan(x)));