Is there a way to directly build only the ‘Protected Model Reference’?

1 view (last 30 days)
Is there a way to directly build only the ‘Protected Model Reference’? I have found that I have to put a subsystem [click the protected model reference, Ctrl+G] around the system before it allows the Code > C/C++ Code > Build Selected Subsystem option. Is there a way around this?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 14 Jun 2019
No there is no direct way to build the code for model reference block. If you want to generate code for only the model reference block then you will have to put it into a subsystem. You can always put the model reference inside a model and build the entire model.
Now, when you want to generate code for only the model reference block, there is no clear understanding as to how the code will interface with other blocks or inputs & outputs. When you put the model reference inside the subsystem, you create a boundary interface to interact with the internal logic of the model reference. Its a very subtle point, about the interface to communicate with the block logic upon code generation.
The short answer to the question is, yes, you have to add the model reference inside a subsystem to generate code for it unless you are building code for the entire top level model. When you are building code for the entire top level model then, in a way, you have already taken care of the interfacing component.

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!