Wrong read API KEY? Matlab Analysis

6 Ansichten (letzte 30 Tage)
Sebastian Romero del villar
Beantwortet: Muskan am 20 Feb. 2024
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!

Antworten (1)

Muskan
Muskan am 20 Feb. 2024
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!

Communitys

Weitere Antworten in  ThingSpeak Community

Kategorien

Mehr zu Read Data from Channel finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by