how to download data from website?

103 views (last 30 days)
Lilya on 23 Mar 2019
Commented: Soo Mee Kim on 11 Jun 2020
Dear all,
I am trying to download data from the following website
my problem is I can not get the files, meaning only the html been located to my computer. (below what I used to locat the link into my machine)
what I need is getting the files separtly and read them.
Thanks for the help.

Accepted Answer

Akira Agata
Akira Agata on 26 Mar 2019
How about the following?
url = '';
str = webread(url);
links = regexp(str,'https://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?(\.nc)','match')';
data = cell(size(links));
for kk = 1:numel(links)
data{kk} = webread(links{kk});
By running this, all the .nc files are downloaded and stored in the cell array data.
Soo Mee Kim
Soo Mee Kim on 11 Jun 2020
Hi, I have the same problem to to download nc files website.
When I tried the following code, both codes gave html file.
Please let me know how to download nc file from the website.
[my own]
fname = '';
downloadURL = '';
options = weboptions('Username', '<username>', 'Password', '<password>');
websave(fname, downloadURL, options);
[From Akira Agata's answer]
downloadURL = '';
options = weboptions('Username', '<username>', 'Password', '<password>');
data = webread(downloadURL, options);

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by