"Nan" values appear when I run the program. How can I remove them?
이전 댓글 표시
I have added photos for you to understand the problem:

댓글 수: 8
Adam
2017년 8월 14일
If you added words too to help us understand the problem that would be even better!
Muhendisleksi
2017년 8월 14일
KSSV
2017년 8월 14일
Getting NaN is easy....divide zero with zero....
Adam
2017년 8월 14일
If it is a cell array (which I assume it must be) then you can replace the NaNs with empty elements [] instead, though whether that is any better or just replacing one thing with another equally unhelpful one I don't know. You cannot simply remove all NaNs though and retain the 2d structure of the data. There has to be 'something' in each cell location, you can't just have a 2d array in which some cells contain 'nothingness'
Jan
2017년 8월 14일
The question is not clear. To explain or fix, what your code does, we have to see the relevant part of the code. If the NaNs should be replaced, we have to know the data type of the shown matrix and the value you want to get instead.
Please, Muhendisleksi, do not let us guess the details.
Muhendisleksi
2017년 8월 15일
John D'Errico
2017년 8월 15일
NaNs are the result of an indeterminate operation. So you did something where the computer did not have a valid result to place there.
Essentially, it is best if you show how the NaNs were created. Then you can "remove" them by not creating them in the first place.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!