Save a .txt file

6 次查看(过去 30 天)
Bob Choy
Bob Choy 2012-12-15
Hey, I need help on the following:
I have a .txt file with many URLs where each line is a diferent URL. Each URL contains only a bunch of text and numbers, nothing else. How do I create a function that reads that same .txt file, accesses each one those URLs and saves to my desktop a .txt that contains the data from that URL. One .txt file per URL.
Thank you for you time.

采纳的回答

Image Analyst
Image Analyst 2012-12-15
Did you check the help for fgetl()?
fid = fopen('fgetl.m');
urlString= fgetl(fid);
while ischar(urlString)
disp(urlString)
urlString = fgetl(fid);
webPageContents = urlread(urlString);
% Save it, or whatever.....
end
fclose(fid);
  4 个评论
Bob Choy
Bob Choy 2012-12-16
编辑:Bob Choy 2012-12-16
Thats EXACTLY what I needed. Thank you good sir!
Question answered.
Image Analyst
Image Analyst 2012-12-16
Go ahead and mark it so.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Language Support 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by