mean - MATLAB giving me NAN values, can't figure out why -


i'm sure whatever problem here pretty simple, cannot figure out @ all.

i have simple data file. .csv file column of labels, , column of values associated each label. trying simple operations involving vector, matlab keeps giving me nan values.

even if mean(vector) nan!

i can't figure out why. there no nan values in vector. numeric. typed command isnumeric(vector) , got value of 1. used loop cycle through every value in vector, , of them numeric.

i have copied of data new csv file , tried that. still gives me nan.

i cannot @ figure out going on here. have no problems doing same other vectors. problem matlab won't tell me or problem is, gives me nan.

any theories on going on, here? or idea of way check vector see matlab having trouble reading?

i using matlab r2008a, on mac.

this return indices of data supposedly nan:

find(isnan(vector)) 

you can use nanmean function in statistics toolbox, ignores nan values in data. there nan- versions of many of other common stats functions nan used denote empty or "missing" value in datasets.

another way possibly nan mean(vector) without having such values in data if both inf , -inf appear there. i.e., mean([-inf 1 2 3 inf]) returns nan. check this, can following:

any(vector==inf) && any(vector==-inf) 

then can do

find(isinf(vector)) 

to find indices. lastly, find(~isfinite(vector)) find both nan , infinite values.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -