Borrar filtros
Borrar filtros

How to save Bus Object with all dependent Bus Objects to a file programmatically?

24 visualizaciones (últimos 30 días)
I have a script that creates several bus objects in the workspace. There is one main bus object with many bus objects nested inside the main one with several layers. I need to save them all to a file. The problem is, the script won't know the names of the bus objects other than the top level one. So I need to somehow save the top level bus object with all its dependent bus objects. I can do this via the bus editor very easily. You just right click on the bus object and choose "Export of bus object with Dependent Bus Objects to File". That's exactly the functionality I want, but I need to be able to do it programmaticaly. Is this possible?

Respuestas (1)

Nathan
Nathan el 24 de Oct. de 2017
Editada: Nathan el 24 de Oct. de 2017
You can create a Cell array from the top level Simulink Bus and then save that cell array:
topLevelCellArray = topLevelBusName.objectToCell; save('filename.mat','topLevelCellArray);
And then when you load the cell array into the the base workspace again convert it to Simulink bus objects: load('filename.mat'); Simulink.Bus.cellToObject(topLevelCellArray)

Categorías

Más información sobre Component-Based Modeling en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by