File System Basics

Simulink® Real-Time™ file scopes create files on the target computer. To work with these files from the development computer, see SimulinkRealTime.fileSystem. The SimulinkRealTime.fileSystem object allows you to perform file system-like operations on the target computer file system.

Note: The SimulinkRealTime.fileSystem object will be removed in a future release. See the release note for file system commands to use instead. These commands use the SimulinkRealTime.openFTP function and the functions for the MATLAB ftp object.

You cannot direct the scope to write the data to a file on the Simulink Real-Time development computer. When the software has written the signal data file to the target computer, you can access the contents of the file from the development computer.

The software can write data files to:

  • Hard drive — The target computer hard drive supports a serial ATA (SATA) drive. The Simulink Real-Time software supports file systems of type FAT-32 only.

    Check that the hard drive is not cable-selected and that the target computer can detect it. The maximum file size is limited by the FAT-32 file system type.

    A Simulink Real-Time file scope can access the target computer hard drive, provided it is formatted with the FAT-32 file system. Simulink Real-Time ignores other file systems.


    In a future release, the SecondaryIDE target setting will be read-only and set to 'off'.

  • ERAM drive — If the target computer has more than 4 GB of RAM, the kernel automatically formats the excess memory as an extended RAM (ERAM) drive. The kernel assigns the ERAM drive the drive letter 'H:'. Use the ERAM drive when you need faster file I/O than you can achieve with other drive types.

    The limitations for hard drives also apply to the ERAM drive.

  • USB drive — To write data files to a USB drive, you must set the USB Support property in Simulink Real-Time.

  • 3.5-inch disk drive – Writing data files to a 3.5-inch disk drive is considerably slower than writing to a hard drive.

There are the following limitations:

  • 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 by '~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 name.

  • Do not write data to the private folder on your target computer. It is reserved for Simulink Real-Time internal use.

You can access signal data files, or other target computer system files, in one of the following ways:

  • If running the target computer standalone, you can access a file by restarting the target computer under an operating system such as DOS. You can access the file through the operating system utilities.

  • If running the target computer linked to a development computer, you can access the target computer file system from the development computer using a SimulinkRealTime.fileSystem function.

You can perform file transfer operations using the functions SimulinkRealTime.copyFileToHost and SimulinkRealTime.copyFileToTarget.

You can perform file system-like tasks using functions such as fopen and fread on the signal data file. File system functions work like the corresponding MATLAB® file I/O functions.

The SimulinkRealTime.fileSystem class also includes file system utilities that allow you to collect target computer file system information for the disk and disk buffers.

This topic focuses primarily on using the SimulinkRealTime.fileSystem functions to work with target computer data files that you generate from a real-time Scope of type file.

For an example of how to perform data logging with the Simulation Data Inspector, see Data Logging With Simulation Data Inspector (SDI).