Matlab describes nanmin
and nanmax
like this:
NANMIN
Minimum value, ignoringNaN
s.
NANMAX
Maximum value, ignoringNaN
s.
But in fact, min
and max
ignore NaN
s too.
Which should I use then?
According to my tests, nanmin
and nanmax
are faster. Is it always like this?
nanmin
just calls min
:
[varargout{1:nargout}]=min(varargin{:});
Similarly for nanmax
. That's it!
In some past release, the built-in min
and max
were updated with the same functionality, ignoring NaN
, and the toolboxes just started pointing to them instead of maintaining their own implementations. Just use max
and min
, unless you are working on special types that might have their own implementations of these functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With