⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tttrypost.cpp

📁 一个很棒的网络控制系统仿真软件
💻 CPP
字号:
#define KERNEL_MATLAB#include "../ttkernel.h" RTsys *rtsys;#include "../trypost.cpp"#include "getrtsys.cpp"void mexFunction( int nlhs, mxArray *plhs[],                  int nrhs, const mxArray *prhs[] ){  mxArray *lhs[1];  rtsys = getrtsys() ; // Get pointer to rtsys   // Check number and type of arguments.   if (nrhs != 2) {    mexErrMsgTxt("ttTryPost: Wrong number of input arguments!\nUsage: ttTryPost(mailboxname, msg)");  }  if (mxIsChar(prhs[0]) != 1) {    mexErrMsgTxt("ttTryPost: mailboxname must be a string");  }  char mailboxname[100];  mxGetString(prhs[0], mailboxname, 100);    int i = ttTryPostMATLAB(mailboxname);  if (i==0) {    // Buffer full    plhs[0] = mxCreateScalarDouble(0.0);  } else {        char msgname[125];    char blockhandle[16];    char msgnbr[16];        // Creating data string: gcbh + mailboxname + "_mail_" + msgNbr    mexCallMATLAB(1, lhs, 0, NULL, "gcbh"); // Get block handle    sprintf(blockhandle, "%f", *(mxGetPr(lhs[0])));    strcpy(msgname, blockhandle);    strcat(msgname, mailboxname);    strcat(msgname, "_mail_");    sprintf(msgnbr, "%d", i);    strcat(msgname, msgnbr);    // Write message data to global workspace    mxArray* msg = mxDuplicateArray(prhs[1]);    mexPutVariable("global", msgname, msg);    mxDestroyArray(msg);    plhs[0] = mxCreateScalarDouble(1.0);  }  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -