Main Content

Model Multiple Data Type Behaviors Using a Data Dictionary

This example shows how to use referenced data dictionaries to store multiple sets of data types for a model. This example also shows how to change the data types by switching the referenced data dictionary.

Open the Model

Open the ex_data_dictionary model.


The ex_data_dictionary model uses a data dictionary to store its data types.

  • mdl_dd.sldd - Main data dictionary

  • flt_dd.sldd - Referenced data dictionary using floating-point data types

  • fix_dd.sldd - Referenced data dictionary using fixed-point data types

Explore How the Data Dictionary is Used in the Model

  1. View the data dictionaries in the Model Explorer. On the Modeling tab, select Model Explorer.

  2. In the lower left corner of the Simulink® Editor, click to open the dictionary.

    The data dictionary defines the parameters of the Gain blocks in the F1 and F2 subsystems. mdl_dd is associated with a referenced data dictionary, flt_dd, which defines the output data types of the gain blocks in the model’s subsystems.

    In the Model Explorer, in the Contents pane, the Data Source column shows the source data dictionary for each Gain block parameter.

    The Model Explorer displaying dictionary objects

  3. Return to the model. Open the F1 subsystem and double-click the a1 block. The block gain is specified as f1_a1_param, which is defined in the data dictionary.

    Block Parameters dialog for the a1 block. The block gain is set to f1_a1_param.

    In the Signal Attributes tab, the block output data type is specified as f1_a1_dt. The data type of f1_a1_dt is defined in the referenced data dictionary, flt_dd.

    Block Parameters dialog for the a1 block. The Output data type is specified as f1_a1_dt.

Change Data Types of Model Parameters

The fix_dd data dictionary contains the same entries as flt_dd, but defines fixed-point data types instead of floating-point data types. To use the fixed-point data types without changing the model, replace flt_dd with fix_dd as the referenced data dictionary of mdl_dd.

  1. In the Model Explorer, in the Model Hierarchy pane, right-click mdl_dd and select Properties.

  2. Remove the referenced floating-point data dictionary. In the Data Dictionary dialog box, in the Referenced Dictionaries pane, select flt_dd and click Remove.

  3. Add a reference to the fixed-point data dictionary. Click Add and select fix_dd. Click OK to close the dialog box.

  4. In the Model Explorer, right-click mdl_dd and select Save Changes.

  5. Return to the Simulink editor and update the model.

    Screenshot of the ex_data_dictionary model. The model uses fixed-point data types.

    The model now uses fixed-point data types.

Related Examples

More About