"Bruno Luong" <firstname.lastname@example.org> wrote in message <email@example.com>... > "Yi " <firstname.lastname@example.org> wrote in message <email@example.com>... > > > > > //Clean up > > mxDestroyArray(incall); > > mxDestroyArray(mout); > > mxDestroyArray(tmp); > > I haven't run your code, just take a quick look, but it seems wrong to destroy TMP separately, since it belongs to INCALL and already destroyed when mxDestroyArray(incall) is invoked. > > Bruno
Thanks for your reply, Bruno. In fact, I have several trys with and without these mxDestroyArray lines and it turns out all the same. Sometimes I can see the returned variable in matlab but with no dimension information. And When I try to access it, the MATLAB crashes.