why is corrcoef returning NaN's?

3 views (last 30 days)
59morgan
59morgan on 30 Mar 2016
Commented: the cyclist on 30 Mar 2016
I'm passing in a single matrix, lots of rows (est 5k), 2 cols -- there are no NaNs in the data, and the data is all doubles, for example:
101.340000000000 139.359000000000
101.500000000000 139.630000000000
101.440000000000 139.920000000000
101.350000000000 139.950000000000
101.135000000000 139.940000000000
any thoughts? thanks

Accepted Answer

the cyclist
the cyclist on 30 Mar 2016
Edited: the cyclist on 30 Mar 2016
I suggest you do one of two things to debug this:
(1)
Upload the actual data here, in a MAT file
(2)
Use corrcoef on sections of your matrix at a time. For example, if your matrix is M, and is 5000x2, then try
corrcoef(M(1:2500,:))
and
corrcoef(M(2501:end,:))
At least one of those two will again give a NaN result. Suppose it is the first one. Then you could similarly split it
corrcoef(M(1:1250,:))
and
corrcoef(M(1251:2500,:))
and so on until you isolate a smaller matrix that give the problem, which you may than be able to just eyeball.
  2 Comments
59morgan
59morgan on 30 Mar 2016
ah. right. there were some nans in there... thx
the cyclist
the cyclist on 30 Mar 2016
I guess I should have first suggested
any(isnan(M(:)))
Glad it worked out.

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!