Can I store a Bus object outside of the base workspace?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Stephen
el 3 de Feb. de 2016
Respondida: Stephen
el 15 de Ag. de 2016
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 comentarios
Respuesta aceptada
Kiran
el 8 de Feb. de 2016
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 comentarios
Más respuestas (1)
Ver también
Categorías
Más información sobre Model, Block, and Port Callbacks en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!