Security error using fred/fetch
147 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I recently updated the Mac software to Sequoia, and started to receive the following error for a code that has always worked before:
Error using fred/fetch
Unable to retrieve data. Verify valid security request.
Do you know how to fix this? I have updated the Matlab version to the latest, and the error still persists.
Thanks!
11 件のコメント
採用された回答
Meet
2025 年 7 月 29 日
Hi Luca,
I was facing a similar issue and figured out that the FRED website recently changed its API and the built-in "fetch" command is no longer able to access the data. This issue can be resolved by downloading the updated "fetch" function and replacing the old function in the toolbox.
Please rename the MATLAB Script "fetch" to "fetch_old" in the below folder on your macOS:
/Applications/MATLAB_R2025a/toolbox/datafeed/datafeed/@fred/
After, please insert the new "fetch" function into the above location. After doing so, the "fetch" function will be able to retrieve data from the FRED website. This set of operations may require administrator privileges.
Note that because of this API change, the output of "fetch" is slightly different and now only includes "SeriesID" and "Data". Also, the "Data" field in the return structure now contains a cell array with an array of doubles, a table or a timetable depending on the input property "DataReturnFormat". Previously, it was either an array of doubles, a table or a timetable not nested in a cell array.
An alternative solution is to use the https://www.mathworks.com/matlabcentral/fileexchange/68247-fred-rest-for-matlab support package on MATLAB File exchange. However, this requires an API key from the FRED website, and has some syntactical changes.
I hope this helps resolve the issue!
6 件のコメント
Yvan Becard
2025 年 9 月 3 日 13:57
I was redirected to this page by a Matlab employee:
Does anyone know how to make FRED© REST work?
Edu Benet Cerda
2025 年 9 月 3 日 14:42
編集済み: Edu Benet Cerda
2025 年 9 月 3 日 15:36
get an API key from the fred website: St. Louis Fed Web Services: API Key
And the code as:
c = fredrs(<KEY>);
tt = c.series('NYGDPPCAPKDWLD','observations');
tt.observations{1}
Follow the api options described here:
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Help and Support についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!