Perform FTP File Operations

From MATLAB®, you can connect to an FTP server to perform remote file operations. The following procedure uses a public MathWorks® FTP server ( To perform any file operation on an FTP server, follow these steps:

  1. Connect to the server using the ftp function.

  2. Perform file operations using appropriate MATLAB FTP functions. For all operations, specify the server object.

  3. When you finish working on the server, close the connection object using the close function.

Example — Retrieve a File from an FTP Server

List the contents of the MathWorks FTP server and retrieve a file named README To view the file, use the type function.

tmw = ftp('');

Welcome to the MathWorks FTP site! 
The MathWorks FTP site has a new structure:

  /incoming - where you upload files to
  /outgoing - where you pick up files from

NOTE: Files in the above directories will be removed after 30 days.

You may also want to visit the MathWorks Web site at

Send questions/comments/suggestions to

View the contents of the pub folder:


% Close the connection

See Also

Was this topic helpful?