## Hans on IoTThingSpeak, MATLAB, and the Internet of Things

### This is machine translation

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

# New MATLAB Analysis Feature – movmax – for ThingSpeak

Posted by Hans Scharler,

My power meter at my house reports its power every few minutes. I capture that data and send it to ThingSpeak. The value reported is the total kilowatt-hour (kWh). I would love to see the maximum value over an hour versus randomly reported values over an hour. With the release of MATLAB R2016a, ThingSpeak users have access to a new suite of data analysis features. One of them is movmax – with movmax, I now can look at my ThingSpeak data over a time and figure a moving window of maximum values. This new feature is highly customizable for your application, but I will show you how I use it.

My data over an hour looks like this: 803, 919, 724, 1349, 1500, 602, 549, 899, 1678, 1577

Using movmax, I can have a sliding window ran over my data to pull out a maximum value from the window and use it for a visualization or further analysis.

The MATLAB code to process my power data is really straightforward.

readChannelID = 97871;
fieldID1 = 1;
thingSpeakPlot(time, data_max);