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

1 次查看(过去 30 天)
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?

采纳的回答

Fangjun Jiang
Fangjun Jiang 2022-4-26
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]

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by