how to protect nested reference models

4 ビュー (過去 30 日間)
cgio
cgio 2021 年 12 月 9 日
回答済み: Sachin Lodhi 2024 年 3 月 5 日
Let's say I have the following structure of 3 reference models:
A is the parent reference model, and inside it references the reference models B and C.
If I want to protect all of them, can I just run: Simulink.ModelReference.protect(A), or should I protect individually all the 3 reference models?
Regards

回答 (1 件)

Sachin Lodhi
Sachin Lodhi 2024 年 3 月 5 日
Protecting the top-level model alone might seem adequate, yet it's considered best practice to secure each model in a set, including any parent and child reference models. This is because the Simulink.ModelReference.protect function is designed to operate on a single model at a time, securing its contents and optionally enabling code generation while keeping the model simulatable. Given your scenario with parent reference model A, which references models B and C, you should run Simulink.ModelReference.protect separately for each of the models A, B, and C. Here's how you could do it:
% Protect model A
Simulink.ModelReference.protect('A', 'Webview', true);
% Protect model B
Simulink.ModelReference.protect('B', 'Webview', false);
% Protect model C
Simulink.ModelReference.protect('C', 'Webview', false);
By protecting each model individually, you ensure that each model is secured according to your protection settings. This approach provides flexibility, allowing you to specify different protection options for each model if needed.
Remember, after protecting a model, you should add the protected version (.slxp file) of that model to the reference model block.

カテゴリ

Help Center および File ExchangeModel Protection についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by