Size of file on target computer



file_size = getfilesize(filesys_object, file_id) returns the size (in bytes) of the file identified by the file_id file identifier 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.


collapse all

Open file data.dat, read its file size, and close it again.

Get the file system and open the file

tg = slrt;
filesys_object = SimulinkRealTime.fileSystem(tg);
file_id = fopen(filesys_object, 'data.dat');

Read the file size.

file_size = getfilesize(filesys_object,file_id)
file_size =


Close the file.

fclose(filesys_object, file_id);

Input Arguments

collapse all

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.

Example: fsys

Data Types: struct

Pass this value to functions that access files on the target computer.

Example: h

Output Arguments

collapse all

This value is the value printed by the dir command.

Introduced in R2014a