downloading data with webread

13 visualizaciones (últimos 30 días)
Nicola Borri
Nicola Borri el 17 de Jul. de 2018
Respondida: Rik el 17 de Jul. de 2018
I would like to download on a local folder files with extension .txt.gz. I tried using webread with options weboptions('KeyName','Accept-Encoding','KeyValue','gzip'), but I cannot understand how to simply save the file in .txt format. Any suggestions?
  2 comentarios
Rik
Rik el 17 de Jul. de 2018
Do you want to save a file as .txt.gz or as .txt? Would a simple renaming be what you want, or should a .txt be extracted from the .gz?
Nicola Borri
Nicola Borri el 17 de Jul. de 2018
I would like to have in my local folder the .txt file

Iniciar sesión para comentar.

Respuesta aceptada

Rik
Rik el 17 de Jul. de 2018
You can use gunzip:
url = 'http://example.com/example.txt.gz';
gunzip(url);
If you can't download the file with that, you'll need websave as an intermediary:
url = 'http://example.com/example.txt.gz';
file = websave('example.txt.gz',url);
gunzip(file);

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by