This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Perform FTP File Operations

From MATLAB®, you can connect to an FTP server to perform remote file operations. The following procedure uses a public FTP server at the National Geophysical Data Center (NGDC). 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 anonymous FTP service at the NGDC.

ngdc = ftp('');
DMSP                         Solid_Earth                  international            wdc                          
INDEX.txt                    ftp.html                     ionosonde                                        
README.txt                   geomag                       mgg                                                 
STP                          hazards                      pub                                                       
Snow_Ice                     index.html                   tmp                                                       

Retrieve a file named INDEX.txt. To view the file, use the type function.

type INDEX.txt
                    National Geophysical Data Center (NGDC)

                          INDEX of anonymous ftp area

-------------- -----------------------------------------------------------------
pub/           Public access area 
DMSP/          Defense Meteorological Satellite Data Archive
geomag/        Geomagnetism and geomagnetics models
hazards/       Natural Hazards data, volcanoes, tsunamis, earthquakes
international/ International program information on IAGA/Oersted/wdc
ionosonde/     Ionosonde data
mgg/           Limited Marine Geology and Geophysics (most data in http area)
OD/            Office of the Director, NGDC
Snow_Ice/      Snow and Ice Data Center
Solid_Earth/   Historic Solid Earth Geophysics
STP/           Solar-Terrestrial Physics
tmp/           Pickup area for temporary outgoing data
wdc/           World Data Service for Geophysics, formerly World Data Centers
-------------- -----------------------------------------------------------------
Please see file README.txt in this directory for more information and how to 
contact NGDC. Direct E-mail inquiries to

Also see our web site:

NGDC is part of the:
U.S. Department of Commerce, National Oceanic and Atmospheric Administration (NOAA),
National Environmental Satellite, Data and Information Service (NESDIS)

View the contents of the pub folder:


Close the FTP connection.


FTP service courtesy of the NGDC. See NGDC Privacy Policy, Disclaimer, and Copyright for NGDC terms of service.

See Also

Was this topic helpful?