Sink blocks help you see or save the results of your Simulink model. They show outputs or save data for later use.
Sink blocks (Scope, Display, To Workspace) in Simulink
Scope Display To Workspace
Scope shows signals as graphs during simulation.
Display shows numeric values updating live.
To Workspace saves data to MATLAB workspace after simulation.
Add a Scope block and connect it to a signal line.
Run simulation to see the signal graph.Add a Display block connected to a signal. Run simulation to see the current value update.
Add a To Workspace block connected to a signal. Set variable name and format. Run simulation. Check saved data in MATLAB workspace.
This code creates a simple Simulink model with a Sine Wave source. It sends the signal to a Scope for live viewing and to a To Workspace block to save data. After simulation, it shows the first 5 rows of saved data in MATLAB workspace.
% Create a simple Simulink model programmatically model = 'simple_model'; new_system(model); open_system(model); % Add Sine Wave block add_block('simulink/Sources/Sine Wave', [model '/Sine Wave']); set_param([model '/Sine Wave'], 'Frequency', '1'); % Add Scope block add_block('simulink/Sinks/Scope', [model '/Scope']); % Connect Sine Wave to Scope add_line(model, 'Sine Wave/1', 'Scope/1'); % Add To Workspace block add_block('simulink/Sinks/To Workspace', [model '/To Workspace']); set_param([model '/To Workspace'], 'VariableName', 'simData'); % Connect Sine Wave to To Workspace add_line(model, 'Sine Wave/1', 'To Workspace/1'); % Run simulation sim(model); % Display saved data simData(1:5,:)
Scope is good for visual checks but does not save data after simulation ends.
Display shows only current values, not history.
To Workspace saves data in different formats: array, structure, or timeseries.
Sink blocks let you view or save simulation outputs.
Use Scope for graphs, Display for live numbers, and To Workspace to save data.
They help analyze and understand your Simulink model results.
Practice
Solution
Step 1: Understand the purpose of Display block
The Display block shows numeric values updating live during simulation.Step 2: Compare with other sink blocks
Scope shows graphs, To Workspace saves data, Gain modifies signals, so they don't show live numbers directly.Final Answer:
Display block -> Option AQuick Check:
Live numeric value = Display block [OK]
- Confusing Scope with Display
- Thinking To Workspace shows live values
- Selecting Gain which is not a sink block
Solution
Step 1: Identify the save format options in To Workspace block
To Workspace block allows saving data as Array, Structure with time, Timeseries, or Matrix.Step 2: Choose the option that saves data as a structure
'Structure with time' saves data as a structure containing time and signals.Final Answer:
Set 'Save format' to 'Structure with time' -> Option CQuick Check:
Structure save format = 'Structure with time' [OK]
- Choosing 'Array' which saves plain arrays
- Confusing 'Timeseries' with structure
- Selecting 'Matrix' which is not a valid option
Signal -> To Workspace block (Save format: Array)
After simulation, what is the format of the saved data in MATLAB workspace?
Solution
Step 1: Understand 'Array' save format in To Workspace block
When 'Array' is selected, only the signal values are saved as a numeric array without time info.Step 2: Compare with other formats
Structure and Timeseries formats include time; cell arrays are not used here.Final Answer:
A numeric array containing signal values only -> Option AQuick Check:
Save format 'Array' = numeric array [OK]
- Assuming time is saved with Array format
- Confusing Array with Timeseries
- Expecting a structure instead of array
Solution
Step 1: Check Scope block connection
Scope requires a connected signal to display data; no connection means no graph.Step 2: Evaluate other options
Display block absence doesn't affect Scope; To Workspace format doesn't affect Scope display; simulation time zero means no data but usually simulation runs longer.Final Answer:
The Scope block is not connected to any signal -> Option DQuick Check:
Scope needs signal connection [OK]
- Thinking Display block affects Scope
- Confusing To Workspace settings with Scope display
- Ignoring signal connections
Solution
Step 1: Identify the sink block for saving data
To Workspace block is designed to save simulation data to MATLAB workspace for post-processing.Step 2: Choose the save format to include time
Setting 'Save format' to 'Structure with time' saves both signal data and time stamps.Final Answer:
Use To Workspace block; set 'Save format' to 'Structure with time' -> Option BQuick Check:
Save data with time = To Workspace + 'Structure with time' [OK]
- Using Display or Scope blocks to save data
- Choosing 'Array' format which lacks time info
- Not configuring save format properly
Ready to prove it?
Pass the test and this pattern moves unknown
