Simulink.MDLInfo class

Package: Simulink

Extract model file information without loading block diagram into memory


The class Simulink.MDLInfo extracts information from a model file without loading the block diagram into memory.

You can create an MdlInfo object containing all the model information properties, or you can use the static methods for convenient access to individual properties without creating the class first. For example, to get the description only:

description = Simulink.MDLInfo.getDescription('mymodel')

To get the metadata only:

metadata = Simulink.MDLInfo.getMetadata('mymodel')

All model information properties are read only.


info = Simulink.MDLInfo('mymodel') creates an instance of the MdlInfo class info and populates the properties with the information from the model file 'mymodel'.

mymodel can be:

  • A block diagram name (for example, vdp)

  • The file name for a file on the MATLAB® path (for example, mymodel.slx)

  • A file name relative to the current folder (for example, mydir/mymodel.slx)

  • A fully qualified file name (for example, C:\mydir\mymodel.slx)

Simulink.MDLInfo resolves the supplied name by looking at files on the MATLAB path, and ignores any block diagrams in memory. This may cause unexpected results if you supply the name of a loaded model, but its file is shadowed by another file on the MATLAB path. If a file is shadowed, you see a warning in the command window. To avoid any confusion, supply a fully-qualified file name to Simulink.MDLInfo.



Name of block diagram.


Type of block diagram. For example, 'Model', Subsystem', 'Library'.


The Description parameter of the model. For details, see Access Model Information Programmatically.


Contains the update release number that was used to save the SLX model. It is zero if the SLX model was saved in a general release, for example, 'R2020a'. It is a positive integer if the SLX model was saved in an update release, for example, 2 if the model was saved in 'R2020a Update 2'.

It is zero for MDL files and for SLX files saved in releases before R2020a.


The fully-qualified Name of the model file.


Names and attributes of the block diagram's root inports, outports, model references, etc., describing the graphical interface if you created a Model Reference block from this model.



Whether the block diagram is a library. Logical.


Name of the user who last saved the model.


Platform architecture when saved, for example, 'glnxa64'.


Names and values of arbitrary data associated with the model.

Structure. The structure fields can be character vectors, numeric matrices of type "double", or more structures. Use the method getMetadata to extract this metadata structure without loading the model.


Model file version number.


Release name that was used to save the model file, for example, 'R2020a'.


Character encoding when saved, for example, 'UTF-8'.


Version number of Simulink® software that was used to save the model file.


getDescriptionExtract model file description without loading block diagram into memory
getMetadataExtract model file metadata without loading block diagram into memory

Copy Semantics

Handle. To learn how this affects your use of the class, see Copying Objects (MATLAB) in the MATLAB Programming Fundamentals documentation.


Construct and view a model information object:

info = Simulink.MDLInfo('mymodel')
% Get the Version when the model was saved
simulink_version = info.SimulinkVersion; 
% Get model metadata
metadata = info.metadata

To add metadata to a model, create a metadata structure containing the information you require and use set_param to attach it to the model. For example:

  metadata.TestStatus = 'untested';
     = '01/01/2011';
  metadata)  % must be a struct

Construct a model information object for a model named mpowertrain, in order to find the names of referenced models without loading the model into memory:

info = Simulink.MDLInfo('mpowertrain')
% Get the Interface property


ans = 
                   Inports: [0x1 struct]
                  Outports: [0x1 struct]
                 Trigports: [0x1 struct]
                 Connports: [0x1 struct]
              ModelVersion: '1.122'
           ModelReferences: {2x1 cell}
    ParameterArgumentNames: ''
        TestPointedSignals: [0x1 struct]

Get the referenced models:


Output is in the form model name / block path | referenced model name:

ans = 
    'mpowertrain/Model Variants|manual_transmission'
    'mpowertrain/engine model|menginemodel'