importEnumTypes
Import enumerated type definitions to data dictionary
Syntax
Description
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)
Examples
Input Arguments
Output Arguments
Tips
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
classdefblock in a MATLAB file or a P-file.importEnumTypesimports type definitions directly from these files if you specify the names of the types to import using the input argumenttargetTypesand if the files defining the types are on your MATLAB path.To avoid conflicting definitions for imported types,
importEnumTypesrenders MATLAB files or P-files ineffective by appending.saveto their names. The.saveextensions cause variables to rely on the definitions in the target data dictionary and not on the definitions in the files. You can remove the.saveextensions to restore the files to their original state.You can use
importEnumTypesto import enumerated types defined using theSimulink.defineIntEnumTypefunction. Because such types are not defined using MATLAB files or P-files,importEnumTypesdoes not rename any files.Use the function
Simulink.findVarsto generate a list of the enumerated types that are used by a model. Then, use the list withimportEnumTypesto import the definitions of the types to a data dictionary. See Enumerations in Data Dictionary for more information.
Version History
Introduced in R2015a