File Exchange Pick of the Week

Our best user submissions

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the Original version of the page.

ThingSpeak functionality ships with R2019a

Posted by Jiro Doke,

Jiro‘s Pick this week is ThingSpeak Support Toolbox by MathWorks Internet of Things Team.

ThingSpeak is MathWorks’ IoT platform. You can use ThingSpeak for free for non-commercial small projects, but you can also purchase a license with enhanced capabilities, such as the ability to send/receive more messages at a higher frequency.

This Toolbox allows you to connect to ThingSpeak directly from your MATLAB to send and receive data. The Toolbox has been around for several years, and you can download this from the File Exchange or from the Add-on Explorer.

Great news to those who have R2019a or newer. Now, this functionality comes built in with your MATLAB! You can start interacting with ThingSpeak right away.

Here’s an example of reading the last 3 days’ worth of data from the MathWorks Weather Station, located in Natick, MA in U.S.A. Below, the fields 2, 3, and 4 are wind speed, humidity, and temperature, respectively.

data = thingSpeakRead(12397,'Fields',2:4,'NumDays',3,'OutputFormat','TimeTable');
numDataPoints = height(data)
numDataPoints =
        4218

Now, we’ll use stackedplot to visualize the 3 data sets.

stackedplot(data);

Comments

Give it a try and let us know what you think here or leave a comment.


Get the MATLAB code

Published with MATLAB® R2019a

Add A Comment

Your email address will not be published. Required fields are marked *

Preview: hide