Why can't I restore disabled links from a model StopFcn callback?

15 vues (au cours des 30 derniers jours)
Åsa Engvall
Åsa Engvall le 18 Fév 2013
I have a model, where I want to disable links before the simulation and to restore the links after the simulation.
The InitFcn callback looks like this: set_param('BreakLinks/LibraryBlock', 'LinkStatus', 'inactive')
It works, the link is disabled. In the same model, the StopFcn callback looks like this: set_param('BreakLinks/LibraryBlock', 'LinkStatus', 'restore')
The link is not restored by the StopFcn. Why not? How can I work around this problem?

Réponse acceptée

TAB
TAB le 19 Fév 2013
It could be because executing StopFcn is also part of simulation. And you can not modify the library link of a block during the simulation process.
Simulation Started --> Execution --> Simulation stopped --> Save Workspace data --> Execute StopFcn --> Simulation finished.
You can modify the links only after simulation is finished.
You can restore the library in save or close callback functions.
  1 commentaire
Åsa Engvall
Åsa Engvall le 19 Fév 2013
Thank you for a clarifying answer. I can probably use the save callback instead.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Model, Block, and Port Callbacks dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by