Clear Filters
Clear Filters

Call "set_param" from C-MEX S-function

2 views (last 30 days)
Zangdaarr
Zangdaarr on 6 Aug 2015
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

Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!