Load signal data from workspace into Simulink model
Simulink / Sources
The From Workspace block reads data into a Simulink® model from a workspace and provides the data as a signal at the block's output. You can load data from the base workspace, model workspace, or mask workspace. You can use the From Workspace block to load signal data into any model or subsystem in a model hierarchy from a workspace accessible to the referenced model or subsystem.
You can specify how the data is loaded, including the sample time, interpolation and extrapolation behavior, and whether to use zero-crossing detection.
In the model, the From Workspace block shows the value of the
Data parameter. For example, if you use the From
Workspace block to load data in the variable x, you
specify x as the value for the Data parameter,
and the block displays x in the model.
Specify data for the From Workspace block to load using the Data parameter. You can specify the value of the Data parameter as a MATLAB® expression, such as a variable name. The expression in the Data parameter must evaluate to data in a format that the From Workspace block supports. For details about how the expression is evaluated, see Symbol Resolution.
The From Workspace block does not load data from a data dictionary. Use a data dictionary to store only design data for a model, not simulation input data. You can store design data related to the From Workspace block, such as the value for the Sample time parameter, in a data dictionary.
The From Workspace block supports loading partially specified
data for a bus. To partially specify bus data, set bus elements for which you do
not need to load data to [].
To load data that was logged in array format using the To File
block, transpose the array so that the time values are in a single column rather
than a single row. You can use the transpose function and save the
transposed data to a new file.
For programmatic simulations using the sim, parsim, or batchsim functions, you can use the Simulink.SimulationInput object
to specify the data for the From Workspace block to load.
From File | From Spreadsheet | Inport | Outport | To File | To Workspace