How can I extract data using Python or Matlab?

Home > Resources > Knowledge Base > How can I extract data using Python or Matlab?

How can I extract data using Python or Matlab?

You can extract iQunet data via OPC UA, Google Sheets/Excel or GraphQL. For all 3 options there is the possibility to perform the extraction in Matlab and/or Python.

 

For OPC UA communication in Python the OPCUA-asyncio library can be used (https://github.com/FreeOpcUa/opcua-asyncio). You can find some example scripts on our Github page (https://github.com/iqunet/sern). Matlab also offers an extension to read data directly out of OPC UA (https://nl.mathworks.com/products/opc.html and https://nl.mathworks.com/pricing-licensing.html?prodcode=OT).

 

The Excel files you created with the “Sheets” button in the iQunet dashboard can be read in Python using the Pandas library (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html) or the xlrd library (http://xlrd.readthedocs.io/en/latest/api.html). In Matlab you can use the readtable function (https://nl.mathworks.com/help/matlab/ref/readtable.html).

The csv files you created with the “Data Explorer” (only available as from version 1.2.8) can be read in Python using the standard csv library (https://docs.python.org/3/library/csv.html). In Matlab you can use the readmatrix function (https://nl.mathworks.com/help/matlab/ref/readmatrix.html).

 

For GraphQL the gql library of Python can be used (https://github.com/graphql-python/gql). Make sure to install the latest version from Github (with pip you can use the following command: pip install -e git+git://github.com/graphql-python/gql.git#egg=gql). You can find 2 example Python scripts using gql on our Github page. For Matlab there is no extension or toolbox available for the moment.