필터 지우기
필터 지우기

How to use Thingspeak to return just data and not timestamp

조회 수: 5 (최근 30일)
David Morgan
David Morgan 2022년 9월 14일
답변: Garv Agarwal 2023년 6월 19일
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

답변 (1개)

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

카테고리

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