Borrar filtros
Borrar filtros

How to use Thingspeak to return just data and not timestamp

5 visualizaciones (últimos 30 días)
David Morgan
David Morgan el 14 de Sept. de 2022
Respondida: Garv Agarwal el 19 de Jun. de 2023
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

Respuestas (1)

Garv Agarwal
Garv Agarwal el 19 de Jun. de 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

Categorías

Más información sobre Read Data from Channel en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by