Wednesday, December 21, 2005

set all NaN's to 0

NaN's are tricky. NaN==NaN is false, so you can't say x(x==NaN) = 0;
Instead, use the function isnan, as in: x(isnan(x)) = 0;

No comments:

Post a Comment