Skip to content

Instantly share code, notes, and snippets.

@indaco
Created June 7, 2017 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indaco/0401e40e6753f369300b5a6fc4e41139 to your computer and use it in GitHub Desktop.
Save indaco/0401e40e6753f369300b5a6fc4e41139 to your computer and use it in GitHub Desktop.
Sample Matlab script to retrieve data from the Predix Time Series and show a chart
url = '<predix-time-series-query-url-here>';
options = weboptions('HeaderFields',{'Predix-Zone-Id' '<predix-time-series-one-id-here>';'Authorization' '<token-here>';'Content-Type' 'application/json';'Request-Method' 'post'});
payload ='{"tags":[{"name":"<tag-name-here>"}],"start":"1y-ago"}';
data = webwrite(url, payload, options);
plot(data.tags.results.values(:,1), data.tags.results.values(:,2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment