Need help in accessing Year/Month/Date data from a ftp server
1 view (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Walter Roberson
on 27 Jun 2015
Edited: Walter Roberson
on 27 Jun 2015
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);
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!