You can acquire signal data into multiple, dynamically named files on the target computer. For example, you can acquire data into multiple files to examine one file while the scope continues to acquire data into other files.
To acquire data into multiple files, you can include a real-time file scope in your Simulink® Real-Time™ model. Alternatively, after you build a real-time application and download it to the target computer, you can add a file scope to that application. You can then configure that scope to log signal data to multiple files.
For example, configure a file scope named
the real-time application. The file scope has these characteristics:
Logs signal data into up to nine files whose sizes do not exceed 4096 bytes.
Creates files whose names contain the character vector
In the MATLAB® window, type:
tg = slrt; tg.StopTime = Inf;
This parameter value directs the real-time application to run indefinitely.
To add a file scope, type:
sc = addscope(tg, 'file');
To enable the file scope to create multiple log files, type:
sc.DynamicFileName = 'on';
Enable this setting to enable logging to multiple files.
To enable file scopes to collect data up to the number of samples, and then start over again, type:
sc.AutoRestart = 'on';
Use this setting for the creation of multiple log files.
To limit each log file size to
sc.MaxWriteFileSize = 4096;
You must use this property. Set
a multiple of the
To enable the file scope to create multiple log files with the same name pattern, type:
sc.Filename = 'file_<%>.dat';
This sequence directs the software to create up to nine log
the target computer file system.
To add signal 4 to the file scope, type:
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.
To start the scope, type
To start the real-time application, type
The software creates a log file named
writes data to that file. When the size of
4096 bytes (value of
MaxWriteFileSize), the software
closes the file and creates
file_2.dat. When its
size reaches 4096 bytes, the software closes it and creates
and so on.
The software repeats this sequence until it fills the last log
file_9.dat. If the real-time application
continues to run and collect data after
the software reopens
file_1.dat and overwrites
the existing contents. It cycles through the other log files sequentially.