How to use Thingspeak to return just data and not timestamp

4 vues (au cours des 30 derniers jours)
David Morgan
David Morgan le 14 Sep 2022
I am wanting to analyse data from a Thingspeak channel but using Thingspeakread is is returning the data and the timestamp which gets shown as NaN. How can I just get the last data points?
Thanks
David

Réponse acceptée

Garv Agarwal
Garv Agarwal le 19 Juin 2023
Hi David,
From my understanding, when you read data using thingSpeakRead, timestamps get returned along with data while you only require the data and you can't seem to get rid of the timestamps. This happens when the OutputFormat value in the thingSpeakRead function is set to 'timetable'.
There are two ways to fix this-
1. You can use the 'matrix' output format if you don't require column labels and your data is made up of only numeric values-
data = thingSpeakRead(channelID,OutputFormat='matrix');
2. If your data contains a mix of numeric and non-numeric data or you require column labels then you can use the 'table' output format-
data = thingSpeakRead(channelID,OutputFormat='table');
and then remove the first column,
data=data(:,2:end);
For more details, you can refer to the thingSpeakRead documentation https://in.mathworks.com/help/thingspeak/thingspeakread.html

Plus de réponses (0)

Catégories

En savoir plus sur Read Data from Channel dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by