How to export Simulink.ConfigSet programmatically to M file?

11 ビュー (過去 30 日間)
Martin
Martin 2023 年 4 月 12 日
回答済み: Martin 2023 年 4 月 12 日
I need to assure consistency in configsets I that I am using in various projects. I work on function which modifies a configset in a defined way and exports the modified configset to M or MAT file. I don't know the 'Name' property of the configset in advance. I have a problem with export to M file.
I am looking for equivalent of GUI procedure described in 'Save a Configuration set' in https://www.mathworks.com/help/simulink/ug/setting-up-configuration-sets.html
I was able to partially solve the problem by creating a temporary Data Dictionary, then Data Dictionary Section 'Configurations', added the current configset as new entry and exported the Section using ExportToFile. However, that creates different output than the GUI procedure for configsets saving.
GUI produces MATLAB function, whereas ExportToFile produces MATLAB script. The function contains some assertions on version, which is convenient so I would like to preserve that. These M files are used differently and my framework is already prepared for the configset as MATLAB function. Moreover I think there must be cleaner solution not involving creating and later deleting dummy files...
I am using MATLAB release R2016a.
It feels like I just cannot find the right command or function, but I have already spent significant time searching without success so I reach out.
Thank you for your time.

採用された回答

Martin
Martin 2023 年 4 月 12 日
Of course, right after posting I found what I needed. Help found here.
I was looking for saveAs function. I cannot find documentation for it, though. A complete list of methods for Simulink.ConfigSet class would be handy when I started searching...

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCOM Component Integration についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by