Returning NaN after mean or sum calculation
Mostra commenti meno recenti
Dear all,
I have the following problem with a file, that I attached below. The file is a .txt. When I'm importing the data, I obtain a 43705x1 double file that I renamed x. When I write
>> mean(x)
or
>> sum(x)
the result I obtain is:
ans =
NaN
Why? I checked the presence of NaN in the file, e.g. by
>> x==NaN
but I obtained
>> max(ans)
ans =
logical
0
Does anyone know why there is NaN?
Thank you!
Risposta accettata
Più risposte (1)
To find the location of NaNs, you can do,
find(isnan(x))
Your current method does not work because NaNs are not equal to one another,
>> NaN==NaN
ans =
logical
0
Categorie
Scopri di più su NaNs in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!