What version of matlab was the flag to omit NaNs in sum (also var, mean, etc) first introduced?
2 views (last 30 days)
Show older comments
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
Answers (1)
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
José-Luis
on 10 Aug 2017
It very much answers your question.
R2016a when doing what Stephen suggests.
See Also
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!