How do I write data to thingSpeak field?

3 ビュー (過去 30 日間)
Rohit Kumar
Rohit Kumar 2020 年 2 月 25 日
回答済み: Christopher Stapels 2020 年 2 月 26 日
I want to write data along with time into a single field of thingspeak. Here is my code : Date=datetime(2019,9,20,0,0,0) tStamps=[Date-caldays(5):caldays(1):Date]' dataField1=[50,15,16,55,60,75]' channelID=XXXXXX; writeKey= ' XXXXXXXXXXXXXXXX'; readKey='XXXXXXXXXXXXXXXX'; thingSpeakWrite(channelID,dataField1,'WriteKey',writeKey) [A,B]=thingSpeakRead(channelID,'ReadKey',readKey) The output is : Date =
datetime
20-Sep-2019 00:00:00
Output
Date =
datetime
20-Sep-2019 00:00:00
tStamps =
6×1 datetime array
15-Sep-2019 00:00:00
16-Sep-2019 00:00:00
17-Sep-2019 00:00:00
18-Sep-2019 00:00:00
19-Sep-2019 00:00:00
20-Sep-2019 00:00:00
dataField1 =
50
15
16
55
60
75
A =
50
B =
datetime
26-Feb-2020 01:53:36
Thus, only one element of the dataField1 and tStamps is shown in the read output. Is there any error in the code?

採用された回答

Christopher Stapels
Christopher Stapels 2020 年 2 月 26 日
Use a table or timetable wher you have datafield1.
thingSpeakWrite(channelID,dataField1,'WriteKey',writeKey)
See the example Write a TimeTable of Data in the doc for thingSpeakWrite.

その他の回答 (0 件)

コミュニティ

その他の回答  ThingSpeak コミュニティ

カテゴリ

Help Center および File ExchangeThingSpeak についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by