What should I do for NaN values?

I have an 1x507 array with NaN values and I am using this array for another calculation. That's why I think these are effecting my calculation. What should I do about them? Should they stay as they are or I should do something?

댓글 수: 3

C.J. Harris
C.J. Harris 2018년 3월 13일
Without know what calculation you are doing, only you can answer that. If the calculation is "How many NaN values are there in a 1x507 array?", then keep them, if you are doing some numeric calculation then obviously you can't use the NaN values.
But also, you can't just delete them without understanding why they are there in the first place - why does your source data have NaN values?
Sukru Yavuz
Sukru Yavuz 2018년 3월 13일
편집: Sukru Yavuz 2018년 3월 13일
I need them for my calculation. I don't need to count them. I need to calculate the sums of all 507 columns and save them as a table. Which is again equal to NaN. I think the numbers are very very very lower than zero that's why they are NaN.
likelihood(nn) = multiplycolumns(nn) * bolumler{nn}; (After this step the array has multiple NaN and Inf.) likelihoodsums = sum(likelihood)
Stephen23
Stephen23 2018년 3월 13일
"What should I do about them? Should they stay as they are or I should do something?"
Why do you assume that you have to "do something" about them? NaN values are there for a reason, and it is usually a bad strategy to turn NaN values into some fake data values (e.g. 0): that would probably distort your calculations even more.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 NaNs에 대해 자세히 알아보기

태그

질문:

2018년 3월 13일

댓글:

2018년 3월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by