Websave on csv returns empty file

3 ビュー (過去 30 日間)
Karsten Reuß
Karsten Reuß 2019 年 4 月 5 日
編集済み: Karsten Reuß 2019 年 4 月 6 日
I am trying to download a file with websave.
While downloading the csv with my browser works fine, websave returns an empty csv.
test = websave("test.csv","http://stooq.com/q/d/l/?s=^aor&d1=20190303&d2=20190405&i=d")
Any ideas why this happens and how to fix this?
Like modifying the weboptions?

回答 (2 件)

Cris LaPierre
Cris LaPierre 2019 年 4 月 5 日
I have an idea. When I go to the url specified in the websave command (http://stooq.com/q/d/l/?s=^aor&d1=20190303&d2=20190405&i=d), I just get a blank webpage.
Try using the url that points directly to the csv file.
  2 件のコメント
Karsten Reuß
Karsten Reuß 2019 年 4 月 5 日
Thanks for the hint.
Unfortunately it did not work.
A full link would be:
test = websave('test.csv','https://stooq.com/q/d/l/?s=^aor&d1=20190401&d2=20190405&i=d/^aor_d.csv')
My IE actually showed a blank page with the shorter link, too. Firefox opened directly. With the full link IE now opens the file, just MATLAB does not.
I also tried enabling TLSv1.2. with a java.opts already, but it didn't help either.
Cris LaPierre
Cris LaPierre 2019 年 4 月 5 日
The data might not be stored on a RESTful server.

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


Karsten Reuß
Karsten Reuß 2019 年 4 月 5 日
I found one workaround.
web('http://stooq.com/q/d/l/?s=^aor&d1=20190303&d2=20190405&i=d', '-browser')
Then Firefox (my standard browser) opens and downloads the file correctly. The file appears in my firefox download folder. Then I can rename it can move it to where I want.
But as this is kinda inconvenient, maybe someone still has a more elegant solution?

カテゴリ

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

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by