Effacer les filtres
Effacer les filtres

Mean function not working on vector of doubles?

1 vue (au cours des 30 derniers jours)
Erin Winkler
Erin Winkler le 17 Avr 2018
Commenté : dpb le 17 Avr 2018
Hi all,
I have a vector of 1000 doubles (no NaNs at all) and I'm trying to find the mean of my vector but I'm only getting NaN returned? Can anyone help?
My data looks like:
1.7694
1.9135
1.4977
1.6484
2.1447
1.8067
1.6340
1.8504
1.8398
1.7225
1.5068
1.9008
1.6895
1.7423
1.4253
2.1948
1.8581
1.7909
1.5839
1.6750
1.7101
1.6638
1.3526
1.7562
(and on to 1000 similar estimators, all doubles, no NaNs, no complex numbers, nothing wonky)
And this is what happens:
betaMRmeanB = mean(data)
betaMRmeanB = NaN
Any help would be great.
Thanks!
  2 commentaires
Fangjun Jiang
Fangjun Jiang le 17 Avr 2018
to debug, could you try this and what is the output?
which -all mean
whos data
dpb
dpb le 17 Avr 2018
That may be what a small visible fraction looks like, but I'm betting it isn't what all the data "look like".
SHOW us, don't tell us...
all(isfinite(data))
returns???

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by