Class: Simulink.data.Dictionary
Package: Simulink.data
Import enumerated type definitions to data dictionary
importedTypes = importEnumTypes(dictionaryObj,targetTypes)
[importedTypes,importFailures]
= importEnumTypes(dictionaryObj,targetTypes)
imports to the data dictionary importedTypes
= importEnumTypes(dictionaryObj
,targetTypes
)dictionaryObj
the definitions of one or
more enumerated types targetTypes
. importEnumTypes
does not import MATLAB variables created using enumerated types but instead, in support of
those variables, imports the definitions of the types. The target data dictionary stores
the definition of a successfully imported type as an entry. This syntax returns a list of
the names of successfully imported types. importEnumTypes
saves
changes made to the target dictionary, so before you use
importEnumTypes
, confirm that unsaved changes are
acceptable.
[
additionally
returns a list of any target types that were not successfully imported.
You can inspect the list to determine the reason for each failure.importedTypes
,importFailures
]
= importEnumTypes(dictionaryObj
,targetTypes
)
Before you can import an enumerated data type definition to a data dictionary, you must clear the base workspace of any variables created using the target type.
You can define an enumerated type using a classdef
block
in a MATLAB file or a P-file. importEnumTypes
imports
type definitions directly from these files if you specify the names
of the types to import using the input argument targetTypes
and
if the files defining the types are on your MATLAB path.
To avoid conflicting definitions for imported types, importEnumTypes
renders
MATLAB files or P-files ineffective by appending .save
to
their names. The .save
extensions cause variables
to rely on the definitions in the target data dictionary and not on
the definitions in the files. You can remove the .save
extensions
to restore the files to their original state.
You can use importEnumTypes
to
import enumerated types defined using the Simulink.defineIntEnumType
function.
Because such types are not defined using MATLAB files or P-files, importEnumTypes
does
not rename any files.
Use the function Simulink.findVars
to
generate a list of the enumerated types that are used by a model.
Then, use the list with importEnumTypes
to import
the definitions of the types to a data dictionary. See Enumerations in Data Dictionary for
more information.