importFromBaseWorkspace
Import base workspace variables to data dictionary
Syntax
Description
imports all variables from the MATLAB base workspace to the data dictionary
importedVars
= importFromBaseWorkspace(dictionaryObj)dictionaryObj
without overwriting existing entries in the
dictionary. If any base workspace variables are already in the dictionary, the
function present a warning and a list.
This syntax returns a list of names of the successfully imported variables. A
variable is considered successfully imported only if
importFromBaseWorkspace
assigns the value of the variable to
the corresponding entry in the target data dictionary.
imports base workspace variables to a data dictionary, with additional options
specified by one or more importedVars
= importFromBaseWorkspace(dictionaryObj
,Name,Value
)Name,Value
pair arguments.
[
additionally returns a list of variables that were not overwritten. Use this syntax
if importedVars
,existingVars
]
= importFromBaseWorkspace(___)existingVarsAction
is set to 'none'
, the
default value, which prevents existing dictionary entries from being
overwritten.
[
additionally returns a list of unsupported variables that were not imported. When
there are unsupported variables in the base workspace, if you call this function
without the importedVars
,existingVars
,unsupportedVars
]
= importFromBaseWorkspace(___)unsupportedVars
output argument, Simulink® reports a warning.
Examples
Input Arguments
Output Arguments
Tips
importFromBaseWorkspace
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.If the value of a variable is a
timeseries
object (which a data dictionary cannot store) or a structure with fields identical to a timeseries object,importFromBaseWorkspace
cannot import the variable.
Alternatives
When you use the Simulink Editor to link a model to a data dictionary, you can choose to import model variables from the base workspace. See Migrate Single Model to Use Dictionary for more information.
You can also use the Model Explorer window to drag-and-drop variables from the base workspace into a data dictionary.
Version History
Introduced in R2015a