필터 지우기
필터 지우기

Call "set_param" from C-MEX S-function

조회 수: 2 (최근 30일)
Zangdaarr
Zangdaarr 2015년 8월 6일
Hi,
I am currently trying to stop my simulink model execution from a C-MEX S-Function.
I'm trying to call "set_param" from mexCallMATLAB.
However, the documentation about this function is terrible: very little and complex example, and sometimes the function is not even refered in the example.
My code for now is the following:
mxArray *cell_array_ptr;
/* Create a nrhs x 1 cell mxArray. */
cell_array_ptr = mxCreateCellMatrix((mwSize)nrhs,1);
/* Fill cell matrix with input arguments */
mxSetCell(cell_array_ptr,(mwIndex)0,mxCreateString("gcs"));
mxSetCell(cell_array_ptr,(mwIndex)1,mxCreateString("SimulationCommand"));
mxSetCell(cell_array_ptr,(mwIndex)2,mxCreateString("stop"));
/* Call mexCallMATLAB to display the cell */
mexCallMATLAB(0,NULL,3,&cell_array_ptr,"set_param");
This causes Matlab to crash. Basicaly, I think I am stucked on the "Array of pointers to input arguments" construction and I need to understand exactly what it is and how to construct it.
I'm not looking for something overkill or over beautiful, elegant code, just something that works and that I can put into a function.
Thanks

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by