MEX wrap of C++ nth_element. Plus fast_median, a faster median function. In-place and parallel.
Author: Peter Li
As a follow up on WurmD's comment: "all" Matlab functions work on the first dimension by default so I think a "replacement" method should do so too.
The current behavior of fast_median breaks things like:
med = median(data(:));
Currently I can't use fast_median in my code as I need to be able to change the filtering function and I don't want to code in some special treatment for fast_median... :/
Very usefull - saved me a lot of time!
But there is a problem (Matlab 2008b, don't know about older releases) if a string contains the letter 'i' which is treated as a complex number and the program errors out at a later point. Therefore I added the following to line 141: "|| strcmp(tempString(i),'i')" what fixes the bug.