ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
28 марта
742832
rual (17.03.2017 09:53, просмотров: 1022)
Вопрос к знатокам Матлаб: как прикрутить к симулинку свой код на С++ для моделирования? На чистом си прикручивается без проблем... А вот такая х-ня не катит: #include "mex.h" //#include "detector.c" //#include "detector.cpp" //detector det; class my{ int a; }; void mexFunction(int nlhs, mxArray *plhs[], // результат int nrhs, const mxArray *prhs[]) //аргументы { double *x, *x2, *y; size_t mrows, ncols; mrows = mxGetM(prhs[0]); ncols = mxGetN(prhs[0]); plhs[0] = mxCreateDoubleMatrix((mwSize)mrows, (mwSize)ncols,mxREAL); x = mxGetPr(prhs[0]); y = mxGetPr(plhs[0]); //if (nrhs == 1) detector(y,x); //det.calc(y,x); //else cdet(); // det.clear(); } Компиллер ругается : >> mex detf.cpp Error detf.cpp: 9 syntax error; found `my' expecting `;' Error detf.cpp: 9 syntax error; found `{' expecting `;' Error detf.cpp: 9 skipping `{' Error detf.cpp: 12 unrecognized declaration Warning detf.cpp: 12 empty declaration Warning detf.cpp: 19 local `pointer to double x2' is not referenced 4 errors, 2 warnings C:\PROGRA~1\MATLAB\R2011B\BIN\MEX.PL: Error: Compile of 'detf.cpp' failed. Error using mex (line 206) Unable to complete successfully.