importFromFile
Import variables from MAT-file or MATLAB file to data dictionary section
Syntax
Description
imports variables defined in the MAT-file or MATLAB file importedVars
= importFromFile(sectionObj
,fileName
)fileName
to the data dictionary section sectionObj
without overwriting any
variables that are already in the target section. If any variables are already in
the target section, the function displays a warning and a list in the MATLAB Command
Window. This syntax returns a list of variables that were successfully imported. A
variable is considered successfully imported only if
importFromFile
assigns the value of the variable to the
corresponding entry in the target data dictionary.
imports variables that are already in the target section by taking a specified
action importedVars
= importFromFile(sectionObj
,fileName
,'existingVarsAction',existAction
)existAction
. For example, you can choose to use the
variable values in the target file to overwrite the corresponding values in the
target section.
[
returns a list of variables in the target section that were not overwritten. Use
this syntax if importedVars
,existingVars
]
= importFromFile(___)existingVarsAction
is set to
'none'
, the default value, which prevents existing dictionary
entries from being overwritten.
Examples
Input Arguments
Output Arguments
Tips
importFromFile
can import MATLAB variables created from enumerated data types but cannot import the definitions of the enumerated types. Use theimportEnumTypes
function to import enumerated data type definitions to a data dictionary. If you import variables of enumerated data types to a data dictionary but do not import the enumerated type definitions, the dictionary is less portable and might not function properly if used by someone else.
Alternatives
You can use the Model Explorer to import variables to a data dictionary from a file. See Import Data to Dictionary from File for more information.
Version History
Introduced in R2015a