By default NaN values are "contagious" in Octave: once a value is NaN, any operation on it will be undefined and thus the result will also be NaN. Special functions are provided on Octave-Forge for aggregate operations like max that deal with NaN in data. These functions (nanmean, nanmax,...) skip NaN values.
The NaN-toolbox [1] in CategoryStatistics implements an alternative approach. The functions in the NaN-toolbox skip NaN's by default. The basic assumption is that NaN's are missing values. Hence, NaN - values are not contagious anymore; no special functions like nanmean, nanmax etc. are needed.
Beware though that this might not be the best way of dealing with NaN in your data; NaN-handling does not always mean missing value and depends on the particular application. However, ISNAN(x) can be used in either case to test for NaN's.
For more info, consult the IEEE 754 specification, and the wikipedia http://en.wikipedia.org/wiki/NaN.