Need help in accessing Year/Month/Date data from a ftp server

3 次查看(过去 30 天)
Hello all,
I am interested in reading out the year/month/date data from the following site in my GUI. <ftp://goldsmr2.sci.gsfc.nasa.gov/data/s4pa/MERRA/MAT1NXRAD.5.2.0/>
I have tried the following in my code and it is opening the specific folder i.e of year 2015,January,1.(20150101)
f=ftp('goldsmr2.sci.gsfc.nasa.gov');
cd(f,'data/s4pa/MERRA/MAT1NXRAD.5.2.0/2015/01');
A = mget(f,'MERRA300.prod.assim.tavg1_2d_rad_Nx.20150101.hdf');
file_name = char(A);
Your help will be higly appreciated
Thanks alot in advance.

回答(1 个)

Walter Roberson
Walter Roberson 2015-6-27
编辑:Walter Roberson 2015-6-27
That code works for me, provided that my current directory in MATLAB starts as a directory I have write access to.
The only thing I would change would be as a matter of style. Instead of
file_name = char(A);
I recommend
file_name = A{1};
Also remember to
close(f);

类别

Help CenterFile Exchange 中查找有关 Search Path 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by