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

조회 수: 15 (최근 30일)
Åsa Engvall
Åsa Engvall 2013년 2월 18일
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?

채택된 답변

TAB
TAB 2013년 2월 19일
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
Åsa Engvall
Åsa Engvall 2013년 2월 19일
Thank you for a clarifying answer. I can probably use the save callback instead.

댓글을 달려면 로그인하십시오.

추가 답변 (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