In Matlab Simulink you can access workspace variables from a C-Mex (C++/C) s-function as follows:
To write to workspace from C-Mex, you can use
#include "matrix.h"
...
mxArray* pa = mxCreateDoubleScalar(12.34);
mexPutVariable("base", "myVarName", pa);
Note that you cannot use myVarName in a simulink block unless you call it before or during InitFcn.
Friday, April 19, 2019
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment