Why is the initialization code for a block mask not executed in protected models?
9 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2018 年 4 月 30 日
編集済み: MathWorks Support Team
2024 年 2 月 6 日
I have a protected model reference containing blocks with initialization commands specified on the Initialization pane of the Mask Editor. I expect these commands to execute at model update (Ctrl+D). However, I noticed that they do not execute when I run or update my model.
However, if I use a model reference(unprotected) in place of the protected model reference, the initialization callback runs fine.
How do I use the Initialization commands callback in a protected model reference?
採用された回答
MathWorks Support Team
2023 年 12 月 2 日
編集済み: MathWorks Support Team
2024 年 2 月 6 日
Currently (as of R2018a), the block mask initialization commands do not execute in protected models.
If you have scripts that run in the Initialization Commands, then they will not execute.
There is a way to register callbacks for a protected model is documented as follows:
To refer to the documentation, run the following command in MATLAB R2018a:
web(fullfile(docroot, 'rtw/ug/define-callbacks-for-protected-model.html'))
If you want the protected model to execute any m-code during model initialization, you will need to specify that m-code in the protected model's PreAccess SIM callback.
Please follow the below link to search for the required information regarding the current release:
1 件のコメント
Mikhail
2018 年 4 月 30 日
The question was regarding block callbacks, not model callbacks. Anyways, this is probably not possible because there are no "blocks" in protected model, since "The software stores the protected model as a compiled MEX binary."
その他の回答 (0 件)
参考
カテゴリ
Help Center および File 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!