MATLAB: Mann Kendall returns NaN

tests

Hi,
I have a column of data. Some of this data has NaN values.
When I exeucte the test using the code
[H1,p_value1] = Mann_Kendall(data, 0.05);
The output returns NaN for the p-value.
This is nonsense.
How can I only apply the test to the numerical data, not the data + NaN values?
This will return an accurate result.
Maybe something like 'omitnan' will work?
Or maybe it is not written into the test code?
Any ideas?
Thanks.

Best Answer

Delete the nan values
data(isnan(data)) = [];
[H1,p_value1] = Mann_Kendall(data, 0.05);
or set them to zeros
data(isnan(data)) = 0;
[H1,p_value1] = Mann_Kendall(data, 0.05);