Main Content

Simulink.MDLInfo.getMetadata

Extract SLX or MDL file metadata without loading file

Description

example

m = Simulink.MDLInfo.getMetadata(file) returns the metadata structure associated with the specified SLX 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.

Examples

collapse all

Create a structure that contains metadata information.

m.TestStatus = 'untested';
m.ExpectedCompletionDate = '01/01/2011';

Create a model, update the 'Metadata' parameter, and save the metadata in the model.

new_system('MDLInfoMetadataModel')
set_param('MDLInfoMetadataModel','Metadata',m)
save_system('MDLInfoMetadataModel')

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

Simulink.MDLInfo.getMetadata('MDLInfoMetadataModel')
ans = 

  struct with fields:

                TestStatus: 'untested'
    ExpectedCompletionDate: '01/01/2011'

Input Arguments

collapse all

Name of the SLX 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

Tips

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.

Introduced in R2009b