Borrar filtros
Borrar filtros

Save a .txt file

2 visualizaciones (últimos 30 días)
Bob Choy
Bob Choy el 15 de Dic. de 2012
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.

Respuesta aceptada

Image Analyst
Image Analyst el 15 de Dic. de 2012
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 comentarios
Bob Choy
Bob Choy el 16 de Dic. de 2012
Editada: Bob Choy el 16 de Dic. de 2012
Thats EXACTLY what I needed. Thank you good sir!
Question answered.
Image Analyst
Image Analyst el 16 de Dic. de 2012
Go ahead and mark it so.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Low-Level File I/O en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by