SimulinkRealTime.fileSystem

Manage folders and files on target computer

Description

The SimulinkRealTime.fileSystem object provides access to folders and files on the target computer.

The following limitations hold:

  • 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.

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.

Creation

filesys_object = SimulinkRealTime.fileSystem constructs and returns the file system object corresponding to the default target computer. If you have one target computer or if you designate a target computer as the default target computer in your system, use this form.

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.

filesys_object = SimulinkRealTime.fileSystem(target_object) constructs and returns the file system object corresponding to the target computer that is accessible by target_object.

The SimulinkRealTime.fileSystem function accepts these arguments:

  • target_object — Object representing target computer

    Object that represents the target computer. Before calling this function, make sure that you start the target computer with the Simulink Real-Time kernel and apply the required Ethernet link settings.

  • filesys_object — Object representing the target computer file system

    File system object created by using the SimulinkRealTime.fileSystem creation function.

    The file system object represents the target computer file system. You work with the target computer file system from the development computer by using file system methods.

Properties

No properties.

Object Functions

cdChange folder on target computer
dirList contents of folder on target computer
diskinfoTarget computer drive information
diskspaceReturn the free space and total space on the drive, in bytes
fcloseClose target computer file
fileinfoTarget computer file information
filetableInformation about open files in target computer file system
fopenOpen target computer file for reading and writing
freadRead open target computer file
fwriteWrite binary data to open target computer file
getfilesizeSize of file on target computer
mkdirCreate folder on target computer
pwdPath to currently active folder on target computer
removefileRemove file from target computer
renameRename a file or folder in the target computer disk drive
rmdirRemove empty folder from target computer
selectdriveSelect target computer drive

Examples

collapse all

Create a file system object for the default target computer and use it to list the contents of the current folder

fsys = SimulinkRealTime.fileSystem;
dir(fsys)
4/12/1998     20:00             222390        IO  SYS
 11/2/2003    13:54                  6    MSDOS  SYS
 11/5/1998    20:01              93880  COMMAND  COM
 11/2/2003    13:54  <DIR>           0     TEMP     
 11/2/2003    14:00                 33 AUTOEXEC  BAT
  11/2/2003   14:00                512 BOOTSECT  DOS
  18/2/2003   16:33               4512 SC1SIGNA  DAT
 18/2/2003    16:17  <DIR>           0    FOUND  000
 29/3/2003    19:19               8512     DATA  DAT
 28/3/2003    16:41               8512 DATADATA  DAT
 28/3/2003    16:29               4512 SC4INTEG  DAT
  1/4/2003     9:28          201326592 PAGEFILE  SYS
 11/2/2003    14:13  <DIR>           0    WINNT     
    4/5/2001  13:05             214432 NTLDR      '     
  4/5/2001    13:05              34468 NTDETECT  COM
 11/2/2003    14:15  <DIR>           0  DRIVERS     
  22/1/2001   11:42                217   BOOT    INI'     
 28/3/2003    16:41               8512        A  DAT
 29/3/2003    19:19               2512 SC3SIGNA  DAT
 11/2/2003    14:25  <DIR>           0  INETPUB     
 11/2/2003    14:28                  0   CONFIG  SYS
 29/3/2003    19:10               2512 SC3INTEG  DAT
  1/4/2003    18:05               2512  SC1GAIN  DAT
   11/2/2003  17:26  <DIR>           0 UTILIT~1     

Creates a file system object for the default target computer, assumed to be TargetPC1, and returns the disk space.

fsys = SimulinkRealTime.fileSystem;
diskspace(fsys, 'C:\')
ans = 

     freeDiskSpacebytes: 5.9889e+10
    totalDiskSpacebytes: 6.0005e+10

Creates a file system object for target computer TargetPC1 and returns the disk space.

tg = SimulinkRealTime.target('TargetPC1');
fsys = SimulinkRealTime.fileSystem(tg);
diskspace(fsys, 'C:\')
ans = 

     freeDiskSpacebytes: 5.9889e+10
    totalDiskSpacebytes: 6.0005e+10

See Also

Introduced in R2014a