unable to download data from FRED with Datafeed Toolbox
5 views (last 30 days)
Show older comments
I'm unable to download data using the fred function. I've Matlab R13 and the Datafeed toolbox. I'm able to connect with the FRED website but unable to download the data with the code below. I understand there has been issues with the "http" and I've tried replacing it with "https". With the "https" I'm unable to connect so I kept the original "http" address and been able to connect.
c = fred('http://research.stlouisfed.org/fred2/series'); d = fetch(c,'DEXUSEU');
I'm getting the following error message:
ndex exceeds matrix dimensions.
Error in fred/fetch (line 94) d.Data = [datenum(str2num(tmp(:,1:4)),str2num(tmp(:,6:7)),str2num(tmp(:,9:10))) str2num(tmp(:,11:end))]; %#ok
Error in ChangeDetectionStudy6 (line 18) d = fetch(c,'DEXUSEU');
6 Comments
Keith Taylor
on 30 Jan 2017
I tested the code on version 2016a using both
fred('https://research.stlouisfed.org/fred2/')
or
fred('https://fred.stlouisfed.org/')
and it worked. A couple of possible issues come to mind.
- The version of Matlab that you are using does not support https requests in the datafeed toolbox. Was this working recently and then suddenly stopped?
- Do you need to connect through a proxy? Are you sure that you're connecting the to FRED servers. One way to test, would be to try using the datafeed toolbox to pull data from another website like Yahoo! Finance. https://www.mathworks.com/help/datafeed/yahoo.html
cy
on 8 Sep 2021
Edited: cy
on 8 Sep 2021
On 9/2021
I'm using Matlab2014 and I'm getting the same error reported in this thread back in 2017. Note that this used to work in the past (Windows7 OS). It appears that I'm not getting connection to https url. See code below:
>> url = 'https://research.stlouisfed.org/fred2/'
url =
https://research.stlouisfed.org/fred2/
>> c = fred(url);
Error using fred (line 64)
Unable to connect to given URL.
If I try http address however, this is the command line:
url = 'http://research.stlouisfed.org/fred2/'
c = fred(url);
gdp = fetch(c, 'GDPC1');
This is the error message:
Index exceeds matrix dimensions.
Error in fred/fetch (line 93)
d.Data =
[datenum(str2num(tmp(:,1:4)),str2num(tmp(:,6:7)),str2num(tmp(:,9:10)))
str2num(tmp(:,11:end))]; %#ok
Answers (1)
Kawee Numpacharoen
on 4 Aug 2017
I would suggest upgrading to newer version of MATLAB. Otherwise, you may need to contact MathWorks technical support for alternative solutions. By the way, Datafeed Toolbox no longer support Yahoo! Finance API.
0 Comments
See Also
Categories
Find more on Financial Data in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!