Simulink® Real-Time™ supports eight file scopes. Each file scope can contain as many signals as the target computer resources can support.
You can have at most 128 files open on the target computer at the same time.
The largest single file that you can create on the target computer is 4 GB.
A fully qualified folder name can have a maximum of 248 characters, including the drive letter, colon, and backslash.
A fully qualified file name in the operating system on the
target computer can have a maximum of 260 characters. If the file name is longer than
eight-dot-three format (eight character file name, period, three character extension), the
operating system represents the file name in truncated form (for example, six characters followed
'~1'). MATLAB commands can access the file using the fully qualified file
name or the truncated representation of the name. Some block parameters, such as the Scope block
filename parameter, require 8.3 format for the file
Do not write data to the
private folder on
your target computer. It is reserved for Simulink
If you enter just the file name, the file appears
C:\. To put the file in a folder, create
the folder separately using the target computer command line or the
You can configure the scope to generate multiple, dynamically named files in one session.
Before starting the scope, copy previously acquired data to the development computer. When the file scope starts, the software overwrites previously acquired data in files of the specified name or name pattern. A partially overwritten file or a file that is opened but left unwritten loses its original contents.
You cannot read a file that was written during real-time execution until execution has completed.
After real-time execution, the file scope software
generates a signal data file on the target computer, even if it is
Stand Alone mode. To access
the contents of the signal data file that a file scope creates, use
SimulinkRealTime.fileSystem object from a
development computer Command Window. To view or examine the signal
data, use the
plot function. Saving signal data to files
lets you recover signal data from a previous run in the event of system
The signal data file can quickly increase in size. To gauge the growth rate for the file, examine the file size between runs. If the signal data file grows beyond the available space on the disk, the signal data is corrupted.
The file scope acquires data and writes it to the file named in the FileName parameter. The scope writes data samples into a memory buffer of size given by the Number of Samples parameter. It copies data from the memory buffer into the file in blocks of size given by the WriteSize parameter.
The Number of samples parameter works with the autorestart setting.
Autorestart is on — When the scope triggers, the scope starts collecting data into a memory buffer. A background task examines the buffer and writes data to the disk continuously, appending new data to the end of the file. When the scope reaches the number of samples that you specified, it starts collecting data again, overwriting the memory buffer. If the background task cannot keep pace with data collection, data can be lost.
Autorestart is off — When the scope triggers, the scope starts collecting data into a memory buffer. It stops when it has collected the number of samples that you specified. A background task examines the buffer and writes data to the disk continuously, appending the new data to the end of the file.
When real-time execution stops without an error, both
of the Mode box have the same result. Both settings
cause the model to open a file, write signal data to the file, and
close that file at the end of the session. The differences are in
when the software updates the FAT entry for the file.
Commit mode, the FAT
entry and the actual file size are updated during each file write
Lazy mode, the FAT entry
and the actual file size are updated only when the file is closed
and not during each file write operation.
Lazy mode is faster than
However, if the target computer enters an error state, the system
can stop responding before the file is closed. In
the actual file size can be lost, even though the file was written.
You can lose an amount of data equivalent to the setting of the WriteSize parameter.
Select the type of trigger event in the Scope block
dialog box by setting Trigger Mode to
The number of samples
N to log after triggering
an event is equal to the value that you entered in the Number
of Samples parameter.