You can use model callbacks such as the
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
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.
If you make explicit references to the base workspace by using
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
sensor and sets the parameter
on the value of
if evalin('base','sensor.noiseEnable') enable = 'Enabled'; else enable = 'Disabled'; end
When you migrate to a data dictionary, replace these explicit
base as follows:
if Simulink.data.evalinGlobal(myExampleModel,... 'sensor.noiseEnable') enable = 'Enabled'; else enable = 'Disabled'; end
Simulink.data.evalinGlobalfunction evaluates an expression 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.
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
during migration. Then, Simulink sets
the storage class of these
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
of a model from the command line, convert tunable variables to
You can import, store, or create design data objects of the following data classes in the Design Data section of a Simulink data dictionary.
In addition, you can import, store, or create configuration objects of the following classes in the Configurations section of a Simulink data dictionary.
You can import, store, or create data objects of many built-in and custom classes or data types in the Other Data section of a Simulink data dictionary, except for the following:
Classes in the
that the Design Data and Configurations sections do not accept
Arrays of objects created from built-in or custom classes
Custom classes that have a property with any of these names:
Simulink cannot automatically migrate variables used only by inactive variant models into a data dictionary.
You cannot import certain kinds of design data such
meta class objects and
into the Design Data section of 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
into the Design Data section of a 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.