Mann Kendall returns NaN

4 vues (au cours des 30 derniers jours)
SuzieChan
SuzieChan le 12 Avr 2020
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.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 12 Avr 2020
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);

Plus de réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by