Multithreading in S function
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello All,
I am trying to create a S function in matlab which will read data from a video file and send the frame data via the output port.
The each and every frame information is read using a thread (External framework thread invoked through c++)and the information is sent to in the output pin using mdlOutputs.
The S function I created starts the read thread in mdlStart, but the mdlOutputs is called only after the read thread is stopped. hence mdlOutputs give me only the last frame information for every simulation time step.
I would like to know if it is possible to explicitly invoke mdlOutputs from read thread to receive the each and every frame information.
Thank you very much.
Please suggest if Multithreading is possible with S functions.
Regards Sarfraaz
0 Kommentare
Akzeptierte Antwort
Kaustubha Govind
am 5 Apr. 2011
mdlOutputs must be invoked by the Simulink engine, because it needs the current SimStruct passed in. It is never advisable to call S-function call-back methods from another callback method.
mdlStart is called only once during model execution (at the beginning), whereas mdlOutputs is called at every time step - it seems like you should really be doing your reading in mdlOutputs directly, and not in mdlStart. Is there a reason you chose your current workflow?
14 Kommentare
Kaustubha Govind
am 8 Apr. 2011
The above doc page has a link titled "Creating Pause Blocks": http://www.mathworks.com/help/toolbox/simulink/ug/f11-31373.html#bq0ht63
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!