24 views (last 30 days)

Show older comments

I know that Mathworks pays a lot of attention to this stuff, so I am wondering why the expression

>> min(0,NaN)

is 0. Returning a NaN here seems more logical to me.

Stephen Cobeldick
on 25 Apr 2020

@Bryan: you should make that as an enhancement request.

Another option is to stop relying on inconsistent "default" behavior and always specify any flags, dimensions, etc. for any function that has these kind of options. Although it requires a little more typing, it has the following advantages:

- makes the intention clear
- avoids bugs, e.g. when a matrix ony has one row (and thus min returns a scalar, not a row vector)
- throws an error on versions that do not support that option, rather than silently continuing...

Sean de Wolski
on 21 May 2012

Jan
on 22 May 2012

Walter Roberson
on 21 May 2012

Daniel Shub
on 22 May 2012

Given the behavior of MIN, I find it odd that there is a NANMIN function.

per isakson
on 21 Jun 2012

M Sohrabinia
on 21 Jun 2012

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!