What version of matlab was the flag to omit NaNs in sum (also var, mean, etc) first introduced?

2 views (last 30 days)
Consider...
s = [1 NaN]
x = sum(s,'omitnan')
In matlab 2011b, the code returns an error because the nanflag is not implemented.
In matlab 2015b, the code returns x = 1.
My question is -- in what version of matlab was the nanflag option introduced? I am unable to determine this from the online documentation (or did I miss where it was said?).
  3 Comments
Greg King
Greg King on 10 Aug 2017
I suspect you are right that it is a matter of trial and error to find out this information. On the other hand, I feel sure that MathWorks will have that information properly documented for their internal use, but not necessarily for us workers trying to make sure our code does not break when using different versions.
Stephen23
Stephen23 on 10 Aug 2017
Edited: Stephen23 on 10 Aug 2017
@Greg King: Where does John D'Errico say that this is a matter of "trial and error" ? There does not seem to be any "trial and error" involved in reading the release notes.

Sign in to comment.

Answers (1)

Stephen23
Stephen23 on 10 Aug 2017
Edited: Stephen23 on 10 Aug 2017
It is in the documentation:
and search for "omitnan" to find this under R2016a: "Ignore NaNs and NaTs using 'omitnan' or 'omitnat' in the functions mean, median, std, and sum"
  3 Comments
Stephen23
Stephen23 on 10 Aug 2017
Edited: Stephen23 on 10 Aug 2017
@Greg King: errrr... what? Your question is "What version of matlab was the flag to omit NaNs in sum (also var, mean, etc) first introduced?", and that is what the release notes tell us.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!