how to protect nested reference models
4 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Sachin Lodhi
on 5 Mar 2024
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.
0 Comments
See Also
Categories
Find more on Model Protection in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!