Main Content


Extract SLX, SLXP, or MDL file metadata without loading file



m = Simulink.MDLInfo.getMetadata(file) returns the metadata structure associated with the specified SLX, SLXP, or MDL file without loading the file.

The metadata structure contains the names and attributes of arbitrary data associated with the file. The structure fields can be character vectors, numeric matrices of type double, or more structures.


collapse all

Create a structure that contains metadata.

m.ExpectedCompletionDate = t;
m.TestStatus = 'untested';

Create a new model.


Update the 'Metadata' parameter.


Save the model with the metadata.


Check the model for metadata without loading the model or creating a Simulink.MDLInfo object.

ans = struct with fields:
    ExpectedCompletionDate: 02/14/24
                TestStatus: 'untested'

Input Arguments

collapse all

Name of the SLX, SLXP, or MDL file, specified as a character vector or string scalar.

The file name can include a partial path, complete path, relative path, or no path. When you do not provide a path, the file extension is optional.

To avoid unexpected results caused by shadowed files that share a name, specify a fully qualified file name.

Example: Simulink.MDLInfo('vdp')

Example: Simulink.MDLInfo('mymodel.slx')

Example: Simulink.MDLInfo('mydir/mymodel.slx')

Example: Simulink.MDLInfo('C:/mydir/mymodel.slx')

Data Types: char | string


To add metadata to an SLX or MDL file, create a metadata structure that contains the information you require and use the set_param function to attach it to the file. To extract the information without loading the file, use metadata instead of adding custom data by using the add_param function.

Version History

Introduced in R2009b