Urlread and write to an Excel sheet
이전 댓글 표시
All,
I have the following code which reads the data off of this website http://www.aviationweather.gov/adds/metars/?station_ids=KMCO&std_trans=translated&chk_metars=on&hoursStr=past+18+hours&submitmet=Submit This website is basically the weather data from the last 18 hours around a certain location. What I do now is use urlread to read the data into “metarinfo”. What I want to do is write all of the data in "metarinfo" to an excel file. The problem is that it doesn’t seem to be working right. If I just go to the website manually and highlight all of the data on the web page, then paste it into excel, it looks all nice and neat. However, if I try to have Matlab do it, it doesn’t really work? Is there anyway to do this?
I can easily generate the text file, but the code won’t seem to write the data to Excel.
metarinfo=urlread(['http://www.aviationweather.gov/adds/metars/?station_ids=KMCO&std_trans=translated&chk_metars=on&hoursStr=past+18+hours&submitmet=Submit']);
userDir1 = uigetdir('C:\','Browse to directory');
filePath = [userDir1,'\metarinfo_',datestr(now,30),'.txt'];
fid = fopen(filePath,'w');
xlswrite('file1.xlsx',metarinfo);
If anyone knows how to do this, help is greatly appreciated
Charles
채택된 답변
추가 답변 (1개)
Ken Atwell
2014년 10월 7일
편집: Ken Atwell
2014년 10월 7일
0 개 추천
websave, which is brand new as-of R2014b, might serve you better than urlread and fwrite/xlswrite.
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!