Does what it's supposed to do - but unfortunately only for integer images with max(I(:)) > 1. However, it can easily be adapted for images scaled to, e.g. the interval [0;1] by changing lines 13 and 38 to
h = histc(I(:), 0:0.001:ceil(max(I(:))));
T = g(idx)*0.001;
respectively. Would have been nice, though, if this were already included in the input checking.
Unfortunately, this won't work for me (MATLAB R2012a, Pelles C Version 8.00.19 Release Candidate #6). After copying mexopts.bat to C:\Users\<username>\AppData\Roaming\MathWorks\MATLAB\R2012a\mexopts.bat and changing the paths to the include and lib folders in the file, I receive the following error message when running mex mandelbrot.c:
C:\Program Files\MATLAB\R2012a\extern\include\tmwtypes.h(819): error #2048: Undeclared identifier 'char16_t' (did you mean 'char_T'?).
mandelbrot.c(12): warning #2114: Local 'xi' is not referenced.
mandelbrot.c(12): warning #2114: Local 'xr' is not referenced.
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'mandelbrot.c' failed.
Error using mex (line 206)
Unable to complete successfully.