Returning NaN after mean or sum calculation
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Pierluigi Vellucci
am 12 Feb. 2019
Bearbeitet: Matt J
am 12 Feb. 2019
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!
0 Kommentare
Akzeptierte Antwort
Star Strider
am 12 Feb. 2019
I cannot reproduce the problem you are seeing.
My code:
T = readtable('01-RHab.txt','ReadVariableNames',0);
x = T.Var1;
mean_x = mean(x)
sum_x = sum(x)
producing:
mean_x =
868.811686380379
sum_x =
37974890
0 Kommentare
Siehe auch
Kategorien
Mehr zu Entering Commands finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!