websave adds html to file name

5 ビュー (過去 30 日間)
Francisco de Castro
Francisco de Castro 2020 年 5 月 15 日
コメント済み: Mingming Chen 2021 年 6 月 4 日
Any reason why 'websave' adds a '.html' to the name of the output file?
I'm downloading coronavirus data from John Hopkins University github. I use websave as recomended. No matter what I do, the saved file has a '.html' added after the '.csv'. My code is as follows:
url= 'https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_time_series/';
fileinf= 'time_series_covid19_confirmed_global.csv';
websave(fileinf,url);
The file that is saved has name:
time_series_covid19_confirmed_global.csv.html
Any solutions?
Thanks

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 5 月 15 日
編集済み: Ameer Hamza 2020 年 5 月 15 日
Because URL you mentioned corresponds to a webpage, not a CSV file.
Try the following code.
url = 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv';
fileinf= 'time_series_covid19_confirmed_global.csv';
websave(fileinf,url);

その他の回答 (1 件)

smith lili
smith lili 2020 年 9 月 22 日
The reason is that: In the websave function file, the URL whoe extension is not "html" is taken as "The filename does not have an extension", so "html" will be added. If changing "||" in Line 124 in websave file to "&&", "html" will be not added any more.
  1 件のコメント
Mingming Chen
Mingming Chen 2021 年 6 月 4 日
This actually works! Thank you:)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeWeb Services についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by