Can I store a Bus object outside of the base workspace?
1 次查看(过去 30 天)
显示 更早的评论
I have a model where I am re-using library blocks (atomic reusable function.) I'd like to be able to define the parameters required for each library block using a bus object, so that I can data type the parameters with the bus object, so each function will have a bus object for its parameters. From what I can see the bus objects must be stored in the base workspace, as individual items. This results in me having a lot of bus objects in my base workspace, making it very messy. Is there a way I can store these with the model? Or is there a way I can structure these within the base workspace to organise it better?
0 个评论
采纳的回答
Kiran
2016-2-8
As far as I know, Bus Objects are created in base workspace only. There is no any direct way to create Bus objects in a model workspace.
There is a workaround which would allow Model Reference Library Blocks to use Bus Objects that are not in a separate file and would not pollute the workspace with the created Bus Objects. The bus object can be programmatically created in the Initialization callback of a model which is being referenced by a model reference block. The block objects can then be erased in the StopFcn callback so that no bus objects would be left in the workspace after the model is done executing.
However, this workaround is not scalable as it would require all busses to be created manually in the Initialization callback.
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model, Block, and Port Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!