micahjsmith / bls-matlab Goto Github PK
View Code? Open in Web Editor NEWPull data from Bureau of Labor Statistics (BLS) directly into Matlab
License: MIT License
Pull data from Bureau of Labor Statistics (BLS) directly into Matlab
License: MIT License
Note: I'm using Matlab R2019a on a server.
The first time I tried to use the package, I an error when running the following code (<<>> indicates that I had to redact the information):
d = '<<some_path>>\inputdata\';
path1 = genpath(d) ;
path(path1,path) ;
APIKey = '<<my api key>>' ;
b = bls([], APIKey);
data = fetch(b, 'PRS85006092', 'catalog', 'true');
The error I got was the following (note, it traces the error from the original Matlab test script, Untitled2.m):
Dot indexing is not supported for variables of this type.
Error in bls/fetch>blsExtractDataField (line 127)
value = str2double(field.value);Error in bls/fetch (line 116)
data = arrayfun(@blsExtractDataField, ...Error in Untitled2 (line 14)
data = fetch(b, 'PRS85006092', 'catalog', 'true');
It seems the error could be traced to the command (around line 116):
data = arrayfun(@blsExtractDataField, ...
response.Results.series(iSeries).data, 'un', 0);
I was able to modify the "fetch" command with the following code replacing the above:
try
data = arrayfun(@blsExtractDataField, ...
response.Results.series(iSeries).data, 'un', 0);
catch
data = cellfun(@blsExtractDataField, ...
response.Results.series(iSeries).data, 'un', 0);
end
This seems to have solved the issue, although I am not sure how.
I used your class file and the function. I created a main and typed
b = bls([], I put my API key here);
data = fetch(b, 'PRS85006092', 'catalog', 'true');
I got this message
File: main.m Line: 1 Column: 15
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax
error. To construct matrices, use brackets instead of parentheses.
Good day!
I have written a code around your 'fetch.m' function to retrieve data from the BLS API. The code worked fine until recently and now I am getting the following warning message:
"Request failed with message 'The key: provided by the User is invalid. Please provide a proper key for the operation to be successful."
'>key' is just a placeholder in this warning. In my code, I tried two different keys. The first was the BLS key that I always use and which worked until two days ago, and the second is newly created and runs into the exact same problem.
Below is a minimal, reproducible example that should retrieve the CPI data for all items.
blsKey = >key;
b = bls([], blsKey);
fetch(b,'CUUR0000SA0',2019,'catalog','true')
Again, '>key' must be replaced by a character array with a valid key. In my case, it encounters the above warning.
Any help will be greatly appreciated. Many thanks in advance!
Kind regards
Lauritz
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.