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 folder containing the example. At the MATLAB® command line, enter:
Copy these files to a local writable folder:
ex_data_dictionary.slx — Simulink® model using a data dictionary to store its data
mdl_dd.sldd — Main data
flt_dd.sldd — Referenced data dictionary
using floating-point data types
fix_dd.sldd — Referenced data dictionary
using fixed-point data types
In the folder you copied the files to, open the
In the lower left corner of the Simulink Editor, click to open the dictionary.
The data dictionary defines the parameters of the Gain blocks
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.
Return to the model. Open the
F1 subsystem and double-click
a1 block. The block gain is specified as
f1_a1_param, which is defined in the data dictionary.
In the Signal Attributes tab, the block output data type is
f1_a1_dt. The data type of
is defined in the referenced data dictionary,
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
fix_dd as the
referenced data dictionary of
In the Model Explorer, in the Model Hierarchy pane,
mdl_dd and select
Remove the referenced floating-point data dictionary. In the Data
Dictionary dialog box, in the Referenced Dictionaries
flt_dd and click
Add a reference to the fixed-point data dictionary. Click
Add and select
OK to close the dialog box.
In the Model Explorer, right-click
mdl_dd and select
Return to the Simulink editor and update the model.
The model now uses fixed-point data types.