Skip to content
Permalink
e4ea08dae2
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
34 lines (30 sloc) 1.46 KB
%
% Function: PullData
% Author: Michael T. Ballard (michael.ballard@uconn.edu)
% Date: Spring 2019
%
% Description: The PullData function opens a TCP connection to the
% specified host and places a query to the database designed for the
% HuskyTrack System. The response to this query is then collected and
% stored for further manipulations and analysis. Note that
% time is always considered to be 12:00 AM Midnight, thus the
% end date is exclusive.
%
% Parameters: url - A URL to access the host database's API from
% ie. 'http://sdp40.cse.uconn.edu/api/'
% startTime - A time stamp to indicate the earliest desired
% data. In the form 'YYYYMMDD', ie. 20190503
% (May 3, 2019)
% endTime - A time stamp to indicate the latest desired
% data. In the form 'YYYYMMDD', ie. 20190503
% (May 3, 2019)
%
% Return: dataMat - A struct containing all users and their
% location data retrieved from the host
%
function [dataMat] = PullData(url, startTime, endTime)
api = [url 'locationdata?start=' startTime 'T000000&end=' endTime 'T000000'];
options = weboptions('ContentType', 'json');
data = webread(api);
dataMat = jsondecode(data);
end