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

13 views (last 30 days)
Hi
could you please let me know what is the differences between "sum(x, 3, 'omitnan')" and "nansum(x, 3)" ?

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.

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.

Tags

Community Treasure Hunt

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

Start Hunting!