websave adds html to file name

조회 수: 10 (최근 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 CenterFile Exchange에서 Biological and Health Sciences에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by