Security error using fred/fetch

147 visualizzazioni (ultimi 30 giorni)
Luca
Luca il 26 Lug 2025
Modificato: Edu Benet Cerda il 3 Set 2025 alle 15:36
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 Commenti
Gauthier
Gauthier il 29 Lug 2025
Spostato: dpb il 29 Lug 2025
Hi,
Same error with MATLAB R2024b and windows OS.
Best
Yvan Becard
Yvan Becard il 19 Ago 2025 alle 17:56
Same error with MATLAB R2025a and Ubuntu 24.04.3 LTS

Accedi per commentare.

Risposta accettata

Meet
Meet il 29 Lug 2025
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 Commenti
Yvan Becard
Yvan Becard il 3 Set 2025 alle 13:57
I was redirected to this page by a Matlab employee:
Does anyone know how to make FRED© REST work?
Edu Benet Cerda
Edu Benet Cerda il 3 Set 2025 alle 14:42
Modificato: Edu Benet Cerda il 3 Set 2025 alle 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:

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Help and Support in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by