Weighted median (fast MEX)

Version 1.0.0 (36 KB) by Eran
calculating the weighted median or weighted median + weighted std using a fast MEX functions.
3 Downloads
Updated 11 Oct 2025

View License

Fast MEX functions for calculating the weighted median of an array over some dimension.
--------------------------------------------------
These functions are part of AstroPack/MAATv2:
For updates and revision download AstroPack.
--------------------------------------------------
Credit: Eran Ofek
--------------------------------------------------
Compilied fort linux.
Compilation:
mex -O -R2018a CXXFLAGS="\$CXXFLAGS -fopenmp -O3 -march=native" LDFLAGS="\$LDFLAGS -fopenmp" wmedian_mex.cpp
mex -O -R2018a CXXFLAGS="\$CXXFLAGS -fopenmp -O3 -march=native" LDFLAGS="\$LDFLAGS -fopenmp" wmedianStd_mex.cpp
--------------------------------------------------
Examples (see help files):
[M]=tools.math.stat.mex.wmedian_mex(R,W)
[M]=tools.math.stat.mex.wmedian_mex(R,W,2)
[M,S]=tools.math.stat.mex.wmedianStd_mex(R,W)
[M,S]=tools.math.stat.mex.wmedianStd_mex(R,W,1)

Cite As

Eran (2025). Weighted median (fast MEX) (https://nl.mathworks.com/matlabcentral/fileexchange/182276-weighted-median-fast-mex), MATLAB Central File Exchange. Retrieved .

https://ui.adsabs.harvard.edu/abs/2014ascl.soft07005O/abstract

MATLAB Release Compatibility
Created with R2024a
Compatible with R2024a to R2025b
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0