How do I map a model simulink version obtatained with Simulink.M​DLInfo('my​model') to a MATLAB version (e.g. R2021b)

1 view (last 30 days)
When I call Simulink.MDLInfo('mymodel') to get a Simulink version number with which my model was created, I would like to have a reliable mapping to a MATLAB version (e.g. R2021b, R2020a, etc ) that corresponds to the Simulink version returned (e.g. 9.11...). Is there an API for this, or a data structure that is available for programmatic use by an .m script?

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 26 Apr 2022
It looks like Simulink.MDLInfo() will give you 'ReleaseName'. I am running this in R2018b on an example model 'f14' and an old model of mine.
>> Simulink.MDLInfo('f14')
ans =
MDLInfo with properties:
BlockDiagramName: 'f14'
FileName: 'C:\Program Files\MATLAB\R2018b\toolbox\simulink\simdemos\aerospace\f14.slx'
IsLibrary: 0
SimulinkVersion: '9.2'
ReleaseName: 'R2018b'
FileFormatMinorVersion: ''
ModelVersion: '1.14'
LastModifiedBy: 'The MathWorks Inc.'
Description: ''
SavedCharacterEncoding: 'US-ASCII'
LastSavedArchitecture: 'glnxa64'
Metadata: []
Interface: [1×1 struct]
>> Simulink.MDLInfo('test_delay')
ans =
MDLInfo with properties:
BlockDiagramName: 'test_delay'
FileName: 'D:\Documents\MATLAB\test_delay.slx'
IsLibrary: 0
SimulinkVersion: '9.0'
ReleaseName: 'R2017b'
FileFormatMinorVersion: ''
ModelVersion: '1.35'
LastModifiedBy: 'TO92177'
Description: ''
SavedCharacterEncoding: 'windows-1252'
LastSavedArchitecture: 'win64'
Metadata: []
Interface: [1×1 struct]

More Answers (0)

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!