Borrar filtros
Borrar filtros

Call "set_param" from C-MEX S-function

2 visualizaciones (últimos 30 días)
Zangdaarr
Zangdaarr el 6 de Ag. de 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

Respuestas (0)

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by