Main Content


Close connection to FTP server



close(ftpobj) closes the connection to the FTP server associated with ftpobj.


collapse all

Open a connection to an FTP server. Then close it when your session is finished.

First, connect to the National Centers for Environmental Information (NCEI) FTP server.

ftpobj = ftp('')
ftpobj = 

  FTP Object
     user: anonymous
      dir: /
     mode: binary

Show the contents on the server, and retrieve the README.txt file.

DMSP                         Solid_Earth                  google12c4c939d7b90761.html  mgg                          
INDEX.txt                    coastwatch                   hazards                      pub                          
README.txt                   dmsp4alan                    index.html                   tmp                          
STP                          ftp.html                     international                wdc                          
Snow_Ice                     geomag                       ionosonde                                                 

Close the connection to the FTP server.


FTP service courtesy of the National Centers for Environmental Information (NCEI). See the NCEI Privacy Policy, Disclaimer, and Copyright for NCEI terms of service.

Input Arguments

collapse all

Connection to an FTP server, specified as an FTP object.


  • If you do not run close at the end of your session, then the connection either times out automatically or terminates when you exit MATLAB®.

  • After calling close, calling any other FTP function on the same object automatically reopens the connection.

  • close does not return any output to indicate success or failure.

See Also

Introduced before R2006a