Class: Simulink.MDLInfo
Package: Simulink

Extract model file metadata without loading block diagram into memory


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


metadata = Simulink.MDLInfo.getMetadata('mymodel') extracts the structure metadata associated with the file mymodel, without loading the model.

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)

metadata = info.getMetadata returns the metadata property of the Simulink.MDLInfo object info.

metadata is a structure containing the names and attributes of arbitrary data associated with the model. The structure fields can be character vectors, numeric matrices of type "double", or more structures.

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. If it is important to extract the information without loading the model, use metadata instead of adding custom user data with add_param.


Create a metadata structure and use set_param to attach it to the model:

  metadata.TestStatus = 'untested';
  metadata.ExpectedCompletionDate = '01/01/2011';
  set_param('mymodel','Metadata',metadata) % must be a struct

Get the metadata without loading the model or creating a Simulink.MDLInfo object:

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

Create a Simulink.MDLInfo object containing all the model information properties, and get the metadata property:

info = Simulink.MDLInfo('mymodel')
metadata = info.Metadata