Record, XY Graph
Libraries:
Simulink /
Sinks
Description
You can use the Record block or the XY Graph block to record data to the workspace, to a file, or to both the workspace and a file. When you log data to a file, you can choose to log to a MAT file, an MLDATX file, or an Excel® file. Signals connected to a Record block always log to the Simulation Data Inspector. If you decide that you need to save data after simulation, you can export data from the Record block to the workspace or to any supported file type.
You can also use the Record block to visualize connected signals. To view data for signals connected to the Record block, double-click the block. You have access to simulation controls, such as the Run button, while viewing data in the Record block.
By default, the Record block displays all connected signals on a sparklines plot. A sparkline is added for each connected signal. After sparklines fill the visible space, a scrollbar allows you to continue plotting signals.
Build Visualizations
The Record block supports most visualizations available in the Simulation Data Inspector. When a different visualization makes sense for your data, you can modify the plot layout and plot types using the Layouts option and the plot types selector, labeled Sparklines by default. Use the Layouts list to select a layout of subplots. To change the plot type of a subplot, select the subplot then select the desired plot type from the plot types selector.
For more information, see Log Data to the Workspace and a File Using the Record Block. For examples that show how to use each visualization type, see:
Sparklines — View Many Signals Together Using Sparklines
XY — Visualize Simulation Data on an XY Plot and Analyze Data Using the XY Plot
Map — View and Replay Map Data
Time plot and text editor — Create Plots Using the Simulation Data Inspector
The Record block does not support the array visualization available in the Simulation Data Inspector. The Record block supports logging multidimensional signal data, including variable-size signals, but does not support visualizing multidimensional data. To visualize the data for a multidimensional signal using the Record block, convert the signal with multidimensional sample values to a set of signals, called channels, that each have scalar sample values. For more information, see Analyze Multidimensional Signal Data.
XY Graph Block
The XY Graph block in the Simulink® Sinks library is an alternative configuration of the Record block that visualizes two input signals on an XY plot. The first input port provides the x data for the XY plot, and the second input port provides the y data.
The XY Graph block supports logging and visualizing data for nonscalar inputs. However, the XY visualization does not support multidimensional data. When you connect nonscalar signals to the XY Graph block, you must manually configure which channels or elements of the nonscalar signal provide the x and y data for the XY plot.
Examples
Ports
Input
Parameters
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Tips
To open the Record block in a new window, right-click the block, then select Open In New Window.
To open the Record block in a new tab, right-click the block, then select Open In New Tab.
Extended Capabilities
Version History
Introduced in R2021a