Simulink Reference    
To File

Write data to a file

Library

Sinks

Description


The To File block writes its input to a matrix in a MAT-file. The block writes one column for each time step: the first row is the simulation time; the remainder of the column is the input data, one data point for each element in the input vector. The matrix has this form.

The From File block can use data written by a To File block without any modifications. However, the form of the matrix expected by the From Workspace block is the transposition of the data written by the To File block.

The block writes the data as well as the simulation time after the simulation is completed. The block icon shows the name of the specified output file.

The amount of data written and the time steps at which the data is written are determined by block parameters:

If the file exists at the time the simulation starts, the block overwrites its contents.

Data Type Support

A To File block accepts real signals of type double.

Parameters and Dialog Box

Filename
The fully qualified pathname or filename of the MAT-file in which to store the output. On UNIX, the pathname may start with a tilde (~) character signifying your home directory. The default filename is untitled.mat. If you specify an unqualified filename, Simulink stores the file in MATLAB's working directory. (To determine the working directory, type pwd at the MATLAB command line.)
Variable name
The name of the matrix contained in the named file.
Decimation
A decimation factor. The default value is 1.
Sample time
The sample period and offset at which to collect points. See Specifying Sample Time in the online documentation for more information.

Characteristics

Sample Time
Inherited from driving block
Dimensionalized
Yes


  Time-Based Linearization To Workspace