Can I store a Bus object outside of the base workspace?

2 ビュー (過去 30 日間)
Stephen
Stephen 2016 年 2 月 3 日
回答済み: Stephen 2016 年 8 月 15 日
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?

採用された回答

Kiran
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.

その他の回答 (1 件)

Stephen
Stephen 2016 年 8 月 15 日
As an update, in newer versions bus objects can be stored in a Data Dictionary file.

カテゴリ

Help Center および File ExchangeBlocks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by