Considerations before Migrating to Data Dictionary

Check for Data-Loading Callbacks

You can use model callbacks such as the PreLoadFcn callback to load design data from a file into the base workspace when a model is loaded. For example, the following callback loads design data from the MAT file myData.mat.

load myData

After you migrate to a data dictionary, these callbacks will continue to load design data into the base workspace. Since the model then derives design data from the dictionary, manually remove or comment out these data-loading callbacks.

You can use the Simulink® Manifest Tools to find data-loading callbacks. See Analyze Model Dependencies.

Check Scripts

If you make explicit references to the base workspace by using the handle base in your scripts, consider changing these references. When you move any of your data to a data dictionary, the model no longer looks into the base workspace to find design data.

After you migrate design data to a data dictionary, explicit references to the base workspace cannot resolve and errors can occur.

Consider this example. Here, the script searches the base workspace for variable sensor and sets the parameter enable depending on the value of sensor.noiseEnable.

if evalin('base','sensor.noiseEnable')
	enable = 'Enabled';
	enable = 'Disabled';

When you migrate to a data dictionary, replace these explicit references to base as follows:

if evalinGlobalScope(myExampleModel,'sensor.noiseEnable')
	enable = 'Enabled';
	enable = 'Disabled';

The evalinGlobalScope function evaluates a variable in the global scope of the specified model. Here, the global scope can be in a data dictionary or the base workspace, if the model is not linked to a dictionary.

Check Tunable Parameters

  • If your model is linked to a data dictionary, Simulink ignores storage class information specified in the tunable parameters table of the model.

  • If you use the Simulink interface to migrate a model to use a data dictionary, Simulink also migrates the storage class information of the model. If your model contains storage class information for variables in the base workspace, Simulink converts these variables into Simulink.Parameter objects during migration. Then, Simulink sets the storage class of these Simulink.Parameter objects using the storage class information from the model.

  • If you migrate this model back to the base workspace, Simulink does not restore the storage class information in the model. To preserve the storage class for these variables, use the parameter objects from the data dictionary. You can also manually reset the storage class information in the model.

  • If you set the DataDictionary property of a model from the command line, convert tunable variables to Simulink.Parameter objects using the tunablevars2parameterobjects function.

Valid Design Data Classes

You can import, store, or create design data objects of the following data classes in the Global Design Data part of a Simulink data dictionary.

  • Simulink.AliasType

  • Simulink.Bus

  • Simulink.NumericType

  • Simulink.Parameter

  • Simulink.Signal

  • Simulink.Variant

  • Simulink.dd.EnumTypeSpec


  • embedded.fimath

  • numlti


In addition, you can import, store, or create configuration objects of the following classes in the Configurations part of a Simulink data dictionary.

Data Dictionary Limitations

  • Simulink cannot automatically migrate variables used only by inactive variant models into a data dictionary.

  • You cannot import certain kinds of design data such as meta class objects and timeseries objects into a data dictionary.

  • Simulink does not allow Explicit and Implicit signal resolution for a model linked to a data dictionary. The Signal Resolution parameter of the model is specified in Model Configuration Parameters > Diagnostics > Data Validity. To use a data dictionary, set Signal Resolution to Explicit only.

  • The data dictionary does not support models that contain From Workspace blocks. Further, Simulink does not import simulation data such as timeseries objects into the data dictionary. You can migrate such models in one of the following ways.

    • Before migration, replace From Workspace blocks in your model with other source blocks or a combination of source blocks.

    • Migrate the model without replacing From Workspace blocks. After migration, replace the From Workspace blocks.

  • If a model reference hierarchy is already linked to a data dictionary, you can protect a referenced model that is part of the hierarchy. However, if you migrate a model reference hierarchy that includes a protected model, simulation will fail.

    In other words, migrate a model to use a data dictionary before protecting it.

See Also


More About

Was this topic helpful?