Wrong read API KEY? Matlab Analysis

5 次查看(过去 30 天)
Hi everyone
I would like to ask for help with this noobie issue in matlab Analysis
Im trying to use matlab analysis to calculate dewpoint from temp and humidity captured in one of my private channels, and publish it in a 3rd field in the same.
Here is the code:
% Enter your MATLAB Code below
readChId = 1341385;
readKey = 'AAA';
writeChId = 1341385;
writeKey = 'BBB';
[temp,time] = thingSpeakRead(1341385,'Fields',1,'NumPoints',20);
humidity = thingSpeakRead(1341385,'Fields',2,'NumPoints',20);
b = 17.62;
c = 243.5;
gamma = log(humidity/100) + b*temp./(c+temp);
dewPoint =c*gamma./(b-gamma)
thingSpeakWrite(writeChId,dewPoint,'Fields',3,...
'TimeStamps',time,'Writekey',writeKey);
I have actually two problems.
First: if I set the channel as private, I can't read it. This is the message from console (punto de rocío is the name of Matlab Analysis sketch)
///****************************************///
Error using punto de Rocío (line 8)
Specify a valid read API key, or make the channel public to avoid specifying the read API key.
///****************************************///
I tried to copy/paste from API KEYS, and channel information window from Matlab Analytic display.
I tried writing manually from keyboard.
I tried to renew "read api key", and add a new one, but error remains. The only viable solution was turn the channel to public, and I don't want to let it like that.
The second Problem.
If channel is public, the console procede with the calculation and show me results in the console, but, doesnt publish in the channel.
The console doesnt show any error, just the data processed. Channel doesnt show any data in visualization.
Please can you help me!!? What im doing wrong?
Here is the graphic of the field N°3 (without any data )
(PD I didnt find similar topics from community)
Thank You!

回答(1 个)

Muskan
Muskan 2024-2-20
Hi Sebastian,
The channel currently being using by you is set to "Private". In order to read the data from the channel you will need the Read API Key. This can be found in your Thingspeak account where you created your channel. You can get the get the Read API key by clicking the "API Keys" button as shown in the below picture:
After this, you will need to double click on the ThingSpeak Read block and make the channel as "Private" from the "Channel access" option. Then, write the Read API key as we got from our created channel in the above step.
I hope this helps!

社区

更多回答在  ThingSpeak Community

类别

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