Simulation Data Inspector Import and Export File Format

You can import data stored in CSV and Microsoft® Excel® files into the Simulation Data Inspector to view and analyze. You can also export data from the Simulation Data Inspector to a Microsoft Excel file. The format required for import is the same as the format generated by exporting data from the Simulation Data Inspector. The file always contains time and signal data and can optionally include metadata associated with each signal.

Basic File Format

In the simplest format for CSV and Microsoft Excel files, the first row is a header listing the names of the signals, and the first column is time. The name for the time vector must be time. Subsequent rows list the signal values corresponding to each monotonically increasing time step.

The Simulation Data Inspector does not support time vectors that include Inf and NaN values or signals that include Inf sample values. NaN or empty sample values render as missing data. All built-in data types are supported, as well as enum types. When your signal has an enum data type, specify the name of the enumeration class in the row between the signal name and first data point with the label Enum:, for example, Enum: myEnum. The definition for the enumeration class must be on the MATLAB® path.

Multiple Time Vectors

When your data includes signals with different time vectors, the file can include more than one time vector. Every time vector name must be time. Time vectors specify the time steps for signals to the right, up to the next time vector. For example, the first time column defines the time for signal1 and signal2, and the second time column defines the time steps for signal3.

Signal columns must have the same number of data points as the associated time vector.

Signal Metadata

The file can include metadata for signals to indicate the data type, units, interpolation method, block path, and port index for each signal. Metadata for each signal is listed in rows between the signal names and the signal data. Each piece of metadata is labeled, according to this table.

Property NameValue
Data typeType:
UnitsUnit:
Interpolation methodInterp:
Block PathBlockPath:
Port IndexPortIndex:

When an imported file does not specify signal metadata, the Simulation Data Inspector assumes double data type and linear interpolation. You can specify the interpolation method as linear, zoh (for zero-order hold), or none. If you do not specify units for the signals in your file, after importing the file, you can assign units to the signals in the Simulation Data Inspector. For a list of supported units, enter showunitslist at the MATLAB command line.

You can specify any combination of metadata for each signal in your file. Leave a blank cell for signals with less specified metadata.

Complex, Multidimensional, and Bus Signals

You can import and export complex, multidimensional, and bus signals using CSV and Microsoft Excel files. The signal name for a column of data indicates whether that data is part of a complex, multidimensional, or bus signal.

Multidimensional signals include index information in parentheses. For example, the signal name for a column might be signal1(2,3). When you import data from a file that includes multidimensional signal data, elements in the data not included in the file take zero sample values with the same data type and complexity as the other elements.

Complex signal data is always in real-imaginary format. Signal names for columns containing complex signal data include (real) and (imag) to indicate the columns corresponding to the real and imaginary data. When you import data from a file that includes imaginary signal data without specifying values for the real component of that signal, the real component for the signal values default to zero.

Multidimensional signals can contain complex data. The signal name includes the indication for the index within the multidimensional signal and the real or imaginary tag. For example, signal1(1,3)(real).

Dots in signal names specify the hierarchy for bus signals. For example:

  • busSignal.x

  • busSignal.y.a

Bus signals with a bus data type specification can also include a metadata row indicating the name of the Simulink.Bus object that defines the bus, with the label Bus:.

See Also

|

Related Topics