Use Case

This article provides example .m files for how to use the Bazefield API directly in Matlab scripts and workflow.  It is highly recommended to read and learn about the Bazefield API prior to this integration.

https://bazefield.freshdesk.com/a/solutions/folders/36000193881.


Contact support@bazefield.com or enter a ticket for a live demonstration of this capability.


**The content and files in this article is neither part of the official product release of Bazefield,.  This is strictly an example for the users of Matlab that want to make use of the tool to analyze Bazefield data**



Background

Matlab is an industry leading engineering and analytics tool for signal processing, machine learning, and various types of data visualization.   In certain circumstances, Matlab can be a very handy complimentary tool to Bazefield such that native Matlab functions on machine learning, data processing, and calculations can be applied on top of raw Bazefield data.  


Prerequisites

It is required to both have access to the Bazefield API (with a token) - see Getting Started with the Bazefield API.  It is also required the user has a license for Matlab, and a basic idea of its functionalities.


Steps

1) Download all .m files attached to this article (scroll to bottom) to a common folder, then open Matlab and navigate to that folder like seen below.



The 4 files in this article are described below


a. bazeRestWrapper.m:  examples of underlying Matlab functions which can be used to query the Bazefield API.  

b. rawMeasurements.m:  script executable that will query all raw events from specified Bazefield tags during a specified period. (Raw Measurements Request in Bazefield )

c. aggregateMeasurements.m;  script executable that will query aggregate time series data from specified Bazefield tags during a specified period. (Aggregate Time Series API Requests)

d. aggregateDomainPoints.m:  script executable that will query aggregate domain point data from specified Bazefield domain points during a specified period. (Domain Point Data API Requests )



2) Depending on the test case, open either file b, c, or d described above, change the inputs according to your installation and select "Run"


The example below shows the aggregateMeasurements.m code.  Here the user simply needs to change the query inputs, baseUrl of the server, and API token before selecting run.