Simulink.data.DataSourceWorkspace
Description
A Simulink.data.DataSourceWorkspace
object is a handle object
that can contain data from an external data source.
When you load data from an external source, for example by using the loadVariablesFromExternalSource
function, Simulink® passes a reference to a Simulink.data.DataSourceWorkspace
object to the custom file adapter that can read that external file format. The file adapter,
derived from the Simulink.data.adapters.BaseMatlabFileAdapter
class, loads the data into the
workspace in the form of MATLAB® variables and data objects. The workspace object acts as a cache for Simulink and can run a MATLAB script, similar to a base workspace. Symbol resolution includes symbols in the
workspace. See run
.
Creation
Only Simulink can create and manage a Simulink.data.DataSourceworkspace
object, but you can create another handle for the workspace object by
assignment.
copyWks = dsWks
copyWks = DataSourceWorkspace with no properties
To test a custom file adapter without creating a data source workspace, use the Simulink.data.adapters.AdapterDataTester
object.
Object Functions
clearVariables | Clear specified variables from data source workspace |
clearAllVariables | Clear variables from data source workspace |
getVariable | Return value of variable in data source workspace |
getVariables | Return values of variables in data source workspace |
hasVariables | Check if variables exist in data source workspace |
listVariables | List variables in data source workspace |
run | Execute the specified MATLAB script in data source workspace |
setVariable | Set variable in data source workspace |
setVariables | Set variables in data source workspace |
Examples
Version History
Introduced in R2022b