How to lock code generation support for specific simulink models/subsystems?

조회 수: 5 (최근 30일)
Simon Decker
Simon Decker 2023년 8월 7일
댓글: Simon Decker 2023년 11월 3일
Is it possible to lock specific models e.g. from a library for code generation to avoid reuse in productive code - only use them in Simulink simulations?

답변 (1개)

Yatharth
Yatharth 2023년 8월 30일
Hi Simon, I understand you want to protect a simulink block/model so that it is only used during simulation and is not used while code generation.
Simulink provides a feature called "Model Protection" that allows you to lock models and restrict their usage. Here is how you can use it:
  1. Open the model that you want to lock in Simulink.
  2. Go to the "Model Block" tab in the Simulink Editor.
  3. You will find the "Protection" section.
  4. In the "Protection" section, check the relevant options (Simulate / Generate Code) .
  5. Optionally, you can set a password to further restrict access to the locked model. Enter the password in the "Password" field.
  6. Click "OK" to save the changes and lock the model.
Once the model is locked, it cannot be modified or regenerated for code generation. However, it can still be used for simulations within Simulink.
You can learn more on how to Protect Models to conceal contents here.
  댓글 수: 1
Simon Decker
Simon Decker 2023년 11월 3일
Thanks for your response.
But as far as i understand - the model protection is only for referenced models. The other option as you described,to protect the full .slx file ... but that is also not my intention.
In my case, i created (and work with) a own customized simulink library with various masked library blocks inside (in different levels of abstraction for some functionalities) - and i want only some of this library blocks (high level abstraction blocks) lock against code-generation (or even poping up an error if used in code-generation) to avoid in my team to use the wrong models for use e.g. in the rapid prototyping....

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

카테고리

Help CenterFile Exchange에서 Model Protection에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by