How to save Bus Object with all dependent Bus Objects to a file programmatically?
12 ビュー (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
回答 (1 件)
Nathan
2017 年 10 月 24 日
編集済み: Nathan
2017 年 10 月 24 日
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)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!