Accessing work vectors / simstruc from custom code

1 view (last 30 days)
Csaba
Csaba on 12 Aug 2015
Edited: Csaba on 12 Aug 2015
I have a level-2 c s-function and it uses PWork vectors for storing data structures.
For some reason I have a separate c code that is inlined to the Simulink model's generated code via the Simulink Coder's Custom Code blocks. This other code runs in a separate task and mutually exclusively to the s-function.
Now in this code I would like to access and manipulate the exact same data structure that is used by the s-function.
Can I do this? If yes, how?
If I include the simstruc.h into my other code, it can in theory call the ssGetPWork(SimStruct *S) method, but my problem is this SimStruct *S parameter. It is passed to the s-function like this in the generated model-code:
SimStruct *rts = <modelname>_M->childSfunctions[0];
sfcnOutputs(rts, 0);
I can put this into my other code, but I would like to do it so, that i do not have to know the name of the model. Thanks for any idea!

Answers (0)

Community Treasure Hunt

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

Start Hunting!