remember mexAtExit(&MyExit);

来源:互联网 发布:top域名好吗 编辑:程序博客网 时间:2024/06/05 07:09
#include "mex.h"/* Count is a global variable, so it will be remembered between calls */static int Count = 1;void MyExit(){mexPrintf("MyExit() called!\n");/* Do cleanup here ... */return;}void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){mexAtExit(&MyExit); /* Register MyExit() to run when MEX??function is cleared */mexPrintf("Count=%d\n", Count);Count++; /* Increment Count */return;}/*>> rememberCount=1>> rememberCount=2>> rememberCount=3>> clear rememberMyExit() called!>> */