Some applications buffer several samples of a signal into a frame to process with a single computation. When you log a frame-based signal to the Simulation Data Inspector, you can view and analyze the data for each frame using an array plot, or you can convert the representation of the signal data to undo the buffering. This example converts the representation of a frame-based signal from the model sfcndemo_frame
.
Simulating the model for this example requires a license for DSP System Toolbox™. Converting frame-based data in the Simulation Data Inspector does not require a license for DSP System Toolbox.
Open the model sfcndemo_frame
. Then, mark the output from the A/D Converter block for logging and specify a name for the signal line.
Simulate the model.
Use the Simulink.sdi.getCurrentSimulationRun
function to access the simulation data.
Use the getSignalsByName
function to access the Simulink.sdi.Signal
object for the A/D Converter block output signal named Noisy Signal
.
Check the dimensions for a sample of the signal. The signal has two channels with a frame size of 64, resulting in sample values with dimensions 64-by-2. Because each sample is two-dimensional, the samples are concatenated along the third dimension, such that the time values align with the third dimension of the array of sample values.
To analyze the data for the signal over the duration of the simulation, use the convertToFrames
function to interpret the signal as frame-based.
Check the dimensions for a sample of the signal. After interpreting the signal as frame-based, each sample is a vector, and time aligns with the first dimension of the array of sample values.
Because the resulting signal has fewer than four elements in each sample, the Simulation Data Inspector also automatically converts the signal to channels. You can access the Signal
objects for each channel using the Children
property of the original Signal
object.
Each channel has scalar sample values.