Matlab/C++ pointer convention bug fix