Call "set_param" from C-MEX S-function
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!