PLECS 3.6 Online Help

To File

Purpose

Write time stamps and signal values to a file.

Library

System

Description

pict

While a simulation is running, the To File block writes the time stamps and the values of its input signals to a file. The file format can be either a text file with comma separated values (csv) or a MATLAB data file (mat). CSV files can be imported by all common spreadsheet tools like Microsoft Excel.

In a csv file a new row is appended for each time step. When writing to a MATLAB file the resulting data contains a column for each time step.

The first value for each data record is the simulation time of the current simulation step. The value is followed by the signal values of the input signal.

Parameters

Filename
The name of the data file to write to. Files will be stored relative to the model directory unless an absolute file path is given. The data file will be created if it doesn't exist. An existing file of the same name will be overwritten.
File type
The file format to use for the data file. The file can be written as a text file with comma separated values (csv) or as a MATLAB data file (mat).
Sample time
For positive values the input data will be written to the data file once in the given simulation interval. If the value is set to 0 the input data is written to the data file in each simulation step. See also the Discrete-Periodic sample time type in section Sample Times.