How to run MATLAB function and Simulink model simultaneously?

15 次查看(过去 30 天)
I have a MATLAB function that displays a figure I draw using annotations and I have a Simulink model that records brain signals. What I want to do is run both at the same time, that is, to record the brain signals while the user is looking at the figure displayed by my MATLAB function. When the simulation is over I would display another image from another MATLAB function. What's the best way to do this?

采纳的回答

Kaustubha Govind
Kaustubha Govind 2013-7-12
You can run MATLAB code "simultaneously" with a model only by running it as part of the simulation loop. This can be done by invoking the code using one of the three MATLAB Function blocks from the User-Defined Functions Library.
To run additional code at the end of simulation, configure the model's StopFcn callback to execute the code.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Model, Block, and Port Callbacks 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by