Call "set_param" from C-MEX S-function
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Simulink Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!