CEMD3 has a mex function which is a lot faster