Thursday, November 8, 2007

convert NaN to zeros

the problem with large amount of data is, you don't have an overview of the data.

for example, if you have NaN in your data, and you plot it, it is posible that you don't see where this NaNs are. a good way to find them is using max and min.

if you have some NaNs in your data, and you whant to convert them to zeros (or whatever), use the following command:

data(isnan(data)) = 0; % convert NaN into 0!!!!
have a while!

babouyes

2 comments:

Be_Cee said...

hi,
i have a seriously problem
i have alarge matrix (756 x 756)
but when i want to known value of determinant matlab give me NaN.
How solution thanks before

regard

barend cornelis

otmezger said...

Hi cornelius,

thankx for your comment. i'm not shure what's the biggest size for the commands you are using. it is posible that matlab can't handle such a big matrix. please contact the matlab support or make a post in a matlab forum. sorry