MATLAB Answers

what is the differences between "sum(x, 3, 'omitnan')" and "nansum(x, 3)" ?

8 views (last 30 days)
Behzad Navidi
Behzad Navidi on 28 Oct 2019
Edited: Matt J on 28 Oct 2019
Hi
could you please let me know what is the differences between "sum(x, 3, 'omitnan')" and "nansum(x, 3)" ?

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 28 Oct 2019
nansum() is an older routine that is part of the Statistics Toolbox.
sum() with 'omitnan' is part of a series of general enhancements to handling nan. It requires a newer MATLAB release but no special toolbox.
There might possibly be some differences in details of handling of some datatypes.

  0 Comments

Sign in to comment.

More Answers (1)

Matt J
Matt J on 28 Oct 2019
Edited: Matt J on 28 Oct 2019
Nothing. In earlier versions of Matlab, the 'omitnan' flag wasn't available to the sum command, so you had to either use nansum if you had the Statistics Toolbox or code your own if you didn't.

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags