getrtsys.cpp
来自「一个很棒的网络控制系统仿真软件」· C++ 代码 · 共 43 行
CPP
43 行
static mxArray *rhs[2];static int initialized = 0;RTsys *getrtsys(){ mxArray *lhs[1]; static char buf[100]; RTsys *rtsys; if (!initialized) { rhs[0] = mxCreateScalarDouble(0.0); mexMakeArrayPersistent(rhs[0]); rhs[1] = mxCreateString("UserData"); mexMakeArrayPersistent(rhs[1]); initialized = 1; } mexCallMATLAB(1, lhs, 0, NULL, "gcbh"); double handle = *mxGetPr(lhs[0]); if (handle < 0.0) { mexErrMsgTxt("getrtsys: No block handle.\nKernel primitives may not be called from the MATLAB command window."); } *mxGetPr(rhs[0]) = handle; mexCallMATLAB(1, lhs, 2, rhs, "get_param"); if (mxIsChar(lhs[0]) != 1 || mxGetM(lhs[0]) != 1) { mexErrMsgTxt("getrtsys: UserData is not a string.\nKernel primitives may not be called from the MATLAB command window."); } mxGetString(lhs[0], buf, 100); sscanf(buf, "%p", &rtsys); if (rtsys == NULL) mexErrMsgTxt("getrtsys: UserData is not a pointer"); return rtsys;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?