How to use Thingspeak to return just data and not timestamp

4 次查看(过去 30 天)
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

采纳的回答

Garv Agarwal
Garv Agarwal 2023-6-19
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Read Data from Channel 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by