Contenuto principale

VCD File Format for Exported Simulation Data

R2026b
Since R2026b

You can export simulation data to a value change dump (VCD) file using the Simulation Data Inspector. A VCD file records only changes in signal values over time, which reduces file size compared to formats that store every time step. VCD files are supported by digital simulation viewers such as GTKWave and ModelSim. For more information about how to export data from the Simulation Data Inspector to a VCD file, see Export Data to VCD File.

Data Format in VCD File

The format of data in the VCD file depends on the type of signal being exported. Each signal maps to one or more VCD variables, where each variable represents a single data channel in the file.

Simulink Signal TypeVCD File Format
Scalar signal

Single variable with a value recorded at each change

Scalar signal with complex data

Two variables that represent the real and imaginary parts

Nonscalar signal

Separate variable for each element of the vector, matrix, or array

Nonscalar signal with complex data

Separate variable for each element, each split into real and imaginary parts

Bus, array of buses

Separate variable for each bus element

String

Not supported

Message

Not supported

Variable-size signal

Separate variable for each element, padded to the maximum size across all time steps

Signal Hierarchy

The Simulation Data Inspector organizes signals in the VCD file based on the model hierarchy. Signals that share a common path prefix are grouped together. This structure helps you locate exported signals in your VCD viewer. For example, a signal with block path myModel/Controller/PID/Output is stored in the file under three levels of hierarchy: myModel, Controller, and PID. The signal name Output appears as a variable inside the innermost level.

Timing and Value Changes

Unlike file formats that record a value at every time step, the Simulation Data Inspector writes a signal value to a VCD file only when it differs from the previous time step. This change-only approach minimizes file size.

When you export multiple signals, the Simulation Data Inspector merges the time vectors from all signals into a single sorted timeline.

Signal Representation

For a boolean signal, or a signal whose only values are 0 and 1, the Simulation Data Inspector writes a binary waveform in the VCD file. The Simulation Data Inspector stores all other numeric signals as analog waveforms.

How the Simulation Data Inspector records NaN and Inf values depends on the signal type.

  • For boolean signals, NaN and Inf values are written as unknown.

  • For numeric signals, Inf values are written as zero, and NaN values are skipped, such that the previous value is retained. If the initial value is NaN or Inf, the signal starts at zero.

Limitations

  • Enumeration class names are not preserved in the VCD file. Only the underlying integer index values are written.

  • The export converts fixed-point values to double, which might reduce precision.

  • VCD files do not store signal metadata such as units, data types, or interpolation method.

See Also

Tools

Objects

Functions

Topics