Error using thingSpeakWrite Expected a string scalar or character vector for the parameter name.

I need to send data from MATLAB output to a field on ThingSpeak?
this is my current code.......
% Enter your MATLAB Code below
opts = weboptions('Timeout',15);
data = webread('https://api.thingspeak.com/apps/thinghttp/send_request?api_key=PC4EOCTMNDPPQOSW',opts)
writeChannelID = xxxxx;
% TODO - Enter the Write API Key between the '' below:
writeKey = 'xxxxxxxxxx';
thingSpeakWrite(writeChannelID, data, writeKey);
but it comes up with this in the output????
Lounge_Temp
18
Loft_Temp
6
Lounge_Humidity
62
Loft_Humidity
88
' must be a string scalar or character vector that can represent a field name.
Any ideas how to fix?

 採用された回答

ES
ES 2018 年 1 月 20 日
Isnt this the API ? You missed the 'WriteKey' key in your API call?
thingSpeakWrite(channelID, data, 'WriteKey', writeAPIKey)

1 件のコメント

Hans Scharler
Hans Scharler 2018 年 2 月 16 日
You are correct. 'WriteKey' is missing. Here's the documentation for thingSpeakWrite .

サインインしてコメントする。

その他の回答 (0 件)

コミュニティ

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

カテゴリ

ヘルプ センター および File ExchangeThingSpeak についてさらに検索

質問済み:

2018 年 1 月 19 日

コメント済み:

2018 年 2 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by