ndwmean

Version 1.1.0.0 (2.41 KB) by Russell
Up to n-dimensional weighted mean or average of an array with NaN support
174 Downloads
Updated 17 Apr 2014

View License

ndwmean(array,weights,directions) calculates the n-dimensional weighted mean of an array. The size of the weighting array and the optional input "directions" determine the dimensions in which the weighted mean is applied (see examples). Supports NaN values.

Examples: x = rand(3,3,3,2)
ndwmean(x,rand(1,2)) % 4th dimension
ndwmean(x,rand(3,2),[2 4]) % 2nd and 4th dimensions
ndwmean(x,rand(1,3,1,2)) % 2nd and 4th dimensions
ndwmean(x,rand(1,3)) % 3rd dimension
ndwmean(x,rand(3,3)) % 2nd and 3rd dimensions

Cite As

Russell (2024). ndwmean (https://www.mathworks.com/matlabcentral/fileexchange/45229-ndwmean), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.1.0.0

Added support for arrays with NaN values.

1.0.0.0