フィルターのクリア

thingspeak read --> stock in a variable --> use this variable in thingspeakwrite ? possible ?

2 ビュー (過去 30 日間)
Yacine Hammouche
Yacine Hammouche 2019 年 4 月 25 日
回答済み: Hans Scharler 2019 年 5 月 10 日
Hello,
First of all, sorry for my english, im a french student and my english is far from being perfect.
Im trying to transmit location data from an ARDUINO ESP8266 device that has wifi.
I stock the lat ant longitude data in field 3 and field 4 after transmetting them.
Now, I would like to use matlab to read those data, stocking them into 2 variables, then use thigspeakwrite, to write those variables into location data.
I did this code below, it says that is it ok, but the latitude and longitude fields dont change.
% Template MATLAB code for reading data from a private channel, analyzing
% the data and storing the analyzed data in another channel.
% Prior to running this MATLAB code template, assign the channel ID to read
% data from to the 'readChannelID' variable. Since this is a private
% channel, also assign the read API Key to the 'readAPIKey' variable. You
% can find the read API Key in the right side pane of this page.
% To store the analyzed data, you will need to write it to a channel other
% than the one you are reading data from. Assign this channel ID to the
% 'writeChannelID' variable. Also assign the write API Key to the
% 'writeAPIKey' variable below. You can find the write API Key in the right
% side pane of this page.
% TODO - Replace the [] with channel ID to read data from:
readChannelID = [123456];
% TODO - Enter the Read API Key between the '' below:
readAPIKey = 'AAABBB';
% TODO - Replace the [] with channel ID to write data to:
writeChannelID = [123456];
% TODO - Enter the Write API Key between the '' below:
writeAPIKey = 'XXXYYY';
%% Read Data %%
a= thingSpeakRead(readChannelID,'Fields',[3],'ReadKey', readAPIKey);
b= thingSpeakRead(readChannelID,'Fields',[4],'ReadKey', readAPIKey);
%% Analyze Data %%
% Add code in this section to analyze data and store the result in the
% analyzedData variable.
%analyzedData = data;
%% Write Data %%
thingSpeakWrite(readChannelID,'Location',[a,b,3500],'WriteKey','XXXYYY')
  2 件のコメント
Hans Scharler
Hans Scharler 2019 年 4 月 25 日
Are you using this code on ThingSpeak or using MATLAB on your computer?
Yacine Hammouche
Yacine Hammouche 2019 年 4 月 25 日
Thingspeak --> matlab visualisation

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

回答 (1 件)

Hans Scharler
Hans Scharler 2019 年 5 月 10 日
I would try this using the MATLAB Analytics app. The MATLAB Analytics app can be scheduled to run periodically. Also, on the lines that set "a" and "b" - you can just try adding some test data and see if the test data writes to your ThingSpeak channel. Are you using decimal degrees (ie. 47.12345)?

コミュニティ

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

カテゴリ

Help Center および File ExchangeRead Data from Channel についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by