フィルターのクリア

Importing a table from htm

3 ビュー (過去 30 日間)
Matthew
Matthew 2014 年 4 月 29 日
コメント済み: dpb 2014 年 4 月 29 日
Hi,
I need to import some FX rates from the following website:
The table is located within this webpage and gets updated daily.
Does anyone know how to code the import of the whole table from this website into Matlab into my workspace?
Thanks
  3 件のコメント
Matthew
Matthew 2014 年 4 月 29 日
Sorry but I'm confused by your reply.
Can you explain your suggestion please?
dpb
dpb 2014 年 4 月 29 日
Poke around the links on the Fed site a little and explore their setup explicitly for distributing data instead of just trying to rip the web page. There's an "RSS" button at the top of the page you've linked to and more on data if follow the links...

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

採用された回答

Friedrich
Friedrich 2014 年 4 月 29 日
編集済み: Friedrich 2014 年 4 月 29 日
Hi,
using urlread should do it. Pretty rough code but it gets it done:
html= urlread('http://www.federalreserve.gov/releases/h10/hist/dat00_eu.htm');
txt = regexprep(html,'<[^>]*>','');
starts_at = strfind(txt,'Rate');
ends_at = strfind(txt,'Last update:');
txt = txt(starts_at(end)+4:ends_at-1);
tmp = textscan(txt,'%s','delimiter','\n');
idx=cellfun(@isempty,tmp{1});
tmp = strtrim(tmp{1}(~idx));
date = tmp(1:2:end);
value = tmp(2:2:end);
When doing a small check it looks good:
uitable('data',[date,value])
  1 件のコメント
Matthew
Matthew 2014 年 4 月 29 日
Hi Friedrich,
That's some really nice code.
Thank you for your help.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by