How to export Simulink.ConfigSet programmatically to M file?

15 views (last 30 days)
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.

Accepted Answer

Martin
Martin on 12 Apr 2023
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...

More Answers (0)

Categories

Find more on COM Component Integration in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!