필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
JB
JB 2015년 6월 27일
편집: Walter Roberson 2015년 6월 27일
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