ThingSpeak

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Identify Irregularly Sampled Data

This example shows how to identify irregularly sampled data in a ThingSpeak™ channel. You can apply data preprocessing and data analytics algorithms on regularly sampled data. Hence, it is important to be notified when the time period between measurements becomes irregular. This irregularity could indicate a sensor failure or other issues with the measurement setup. Irregularly sampled data also leads to loss of data for subsequent analytics.

Read Data

ThingSpeak channel 12397 contains data from the MathWorks® weather station, located in Natick, Massachusetts. The data is collected once every minute. Field 4 of the channel contains air temperature data. Read the air temperature data from channel 12397 using the thingSpeakRead function to check for irregularly sampled data.

data = thingSpeakRead(12397,'NumMin',5,'Fields',4,'outputFormat','timetable'); 

Check for Irregular Sampled Data

Data in channel 12397 for the last 60 minutes is stored in data as a timetable. Use isregular function to check if the channel data is regularly sampled. If data is irregularly sampled, then display the time difference.

regularFlag = isregular(data,'Time')
regularFlag =

  logical

   0
if ~regularFlag
    display(diff(data.Timestamps))
end
 4×1 duration array

   00:01:01
   00:01:01
   00:01:00
   00:01:02

See Also

Functions

Was this topic helpful?