convert nms to mex