writing loops to download files using Matlab websave

1 vue (au cours des 30 derniers jours)
alpedhuez
alpedhuez le 20 Avr 2019
Commenté : Walter Roberson le 9 Fév 2022
I want to download files of the form https://www.somecompany.com/xml/A_*.xml
I can download one file using
>> url = 'https://www.somecompany.com/xml/A_20080403.xml';
>> filename = 'A_20080403.xml';
>> outfilename = websave(filename,url)
Is it possible to use a wildcard in the specificaoitn of "url" and "filename" somehow?
Or if I need to write a loop for the filename 20080401 to 20100101, what will it be?

Réponses (1)

Geoff Hayes
Geoff Hayes le 20 Avr 2019
alpedhuez - if you want to write a loop to download all files in the range of 20080401 to 20100101, you could do something like
for k = 20080401:20100101
filename = sprintf('A%d.xml', k);
url = ['https://www.somecompany.com/xml/' filename];
outfilename = websave(filename,url);
end
  2 commentaires
alpedhuez
alpedhuez le 9 Fév 2022
I do not think this code works for the filename of the form 'A20080403.xml'. But not for 'A_20080403.xml'

Connectez-vous pour commenter.

Catégories

En savoir plus sur Downloads dans Help Center et File Exchange

Tags

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by