This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Return free space and total space on the drive, in bytes


disk_space = getDiskSpace(target_object, drive_name)



disk_space = getDiskSpace(target_object, drive_name) returns a structure containing the free space and the total space on the drive, in bytes. If a drive with that name does not exist on the target computer, the function displays an error message.


collapse all

Return the free space and the total space on the C:\ drive on the target computer.

tg = slrt;
disk_space = getDiskSpace(tg,'C:\')
disk_space = 

  struct with fields:

     freeDiskSpacebytes: 5.9885e+10
    totalDiskSpacebytes: 6.0005e+10

Input Arguments

collapse all

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.

Example: tg

Enclose the drive name as a character vector or string scalar. The drive must exist on the target computer.

Example: 'C:\'

Data Types: char | string

Output Arguments

collapse all

Introduced in R2018a