Documentation

Import Data to Dictionary from File

You can import data from a MATLAB file or MAT-file to a data dictionary using the Model Explorer window. Import variables and data objects that are used by a model during simulation to the Design Data section of a dictionary. Import variables and objects that you want to store with a model, but that are not used by the model during simulation, to the Other Data section of a dictionary.

Import Design Data from File

This example shows how to import design data from a file into the Design Data section of a dictionary.

  1. In the Simulink® Editor, select View > Model Explorer to open the Model Explorer.

  2. Click File > Open. Then browse to an existing dictionary.

  3. In the Model Hierarchy pane, right-click the Design Data section of the dictionary and select Import from File. Then browse to and select the MAT-file or MATLAB file that contains the data to import.

    Design data from the MAT-file populate the dictionary. Data appear with DataSource set to the name of the dictionary.

    If you import from the same MAT-file again, Simulink only imports changed or new entries into the dictionary.

Import Other Data from File

This example shows how to import data from a file into the Other Data section of a data dictionary. Use this section to store reference information that is not used by Simulink during simulation, such as data that describe physical equipment and processes that are represented by your model.

  1. In the Simulink Editor, select View > Model Explorer to open the Model Explorer.

  2. Click File > Open. Then browse to an existing dictionary.

  3. In the Model Hierarchy pane, right-click the dictionary node and select Show Empty Sections. Model Explorer reveals the Other Data and Configurations sections of the dictionary, even if they are empty, in addition to the Design Data section.

  4. In the Model Hierarchy pane, right-click the Other Data section of the dictionary and select Import from File. Then browse to and select the MAT-file or MATLAB file that contains the reference data to import.

    Data from the MAT-file populate the Other Data section of the dictionary. Data appear with DataSource set to the name of the dictionary.

    If you import from the same MAT-file again, Simulink only imports changed or new entries into the dictionary.

Related Examples

More About

Was this topic helpful?