How to inline Simulink Bus objects in protected model
Show older comments
Problem description
First the short version as a question. A detailed description of the issue is given afterwards.
How can I make a Protected Model block that contains a multitude of reference systems all connected with busses with defined simulink bus objects without having to load the bus objects in the base workspace or a data dictionary when running the P-model? I want it to be inlined and not externally defined when running the protected model.
Detailed version
I am building a protected model of a model structure with 20-30 reference models inside. All data between the reference models are defined with Simulink Bus objects that are saved in a Data Dictionary, or alternaly in the base workspace.
My problem is that I want to build several P-models where changes are done to element sizes in the busses, and then run the P-models in the same simulation afterwards.
The P-model needs the Bus object in the workspace (or DataDictionary). That is not compatible with the need to run several P-models in the same simulation that uses the same bus objects, but with changes to some parameters and sizes for each model.
I have tested many solutions to try to inline/make them local, but they appear to be inherently treated as a global/external variabel.
Is there a method to achieve this ?
One thing I have not tested is to set the bus element's data scope to "Imported" and then add a Header file. Might this be the solution ? If so, I have 200 bus objects, how do I define the Header file for each ? (I have never done this before)
1 Comment
Mohamad Mehdi
on 27 Mar 2026 at 10:47
Hi, were you able to find a solution?
Answers (0)
Categories
Find more on Model, Block, and Port Callbacks 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!