问题描述
Matlab这样描述nanmin
和nanmax
:
Matlab describes nanmin
and nanmax
like this:
NANMAX
最大值,忽略NaN
s.
但是实际上,min
和max
也会忽略NaN
s.
But in fact, min
and max
ignore NaN
s too.
那我该用哪个?
根据我的测试,nanmin
和nanmax
更快.总是这样吗?
According to my tests, nanmin
and nanmax
are faster. Is it always like this?
推荐答案
nanmin
仅调用min
:
[varargout{1:nargout}]=min(varargin{:});
与nanmax
类似.就是这样!
在过去的某些发行版中,内置的min
和max
已使用相同的功能进行了更新,而忽略了NaN
,并且工具箱只是开始指向它们而不是维护其自己的实现.除非您正在使用可能具有这些功能自己的实现的特殊类型,否则只需使用max
和min
.
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.
这篇关于min和Nanmin的区别是什么? Matlab中的max和Nanmax吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!