unable to download data from FRED with Datafeed Toolbox
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
Walter Roberson
on 23 Jan 2017
Testing in a latter version than yours, I find that the required URL is https://research.stlouisfed.org/fred2/ including the https and including ending in '/' . I find that using http does not work in current versions.
Keith Taylor
on 23 Jan 2017
I work on FRED at the St. Louis Fed. In May we changed our URL from https://research.stlouisfed.org/fred2/series/ to https://fred.stlousifed.org/series/.
Walter Roberson
on 23 Jan 2017
I find in a recent version that I can use either
fred('https://research.stlouisfed.org/fred2/')
or
fred('https://fred.stlouisfed.org/')
but not
fred('https://fred.stlousifed.org/series/')
Perhaps fred() automatically adds on the 'series/' part
Amit K
on 26 Jan 2017
Edited: Walter Roberson
on 6 Aug 2017
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
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
0 votes
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.
Categories
Find more on Time Series 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!