Ajay Kumar in MATLAB Answers
上次活动时间: 2025-5-11

Basically, I am getting temperature values and trying to send an email alert whenever the temperature exceeds a specific point. But however the code runs but yet I am facing an error that says Error using matlab.internal.webservices.HTTPConnector/copyContentToByteArray (line 373) The server returned the status 429 with message "Too Many Requests" in response to the request to URL https://api.thingspeak.com/alerts/send. Error in readContentFromWebService (line 46) byteArray = copyContentToByteArray(connection); Error in webwrite (line 139) [varargout{1:nargout}] = readContentFromWebService(connection, options); Error in Customer Temperature Email Trigger (line 10) webwrite(alertUrl , "body", alertBody, "subject", alertSubject, options); I am also attaching the code. channelID = 1614947; alertApiKey = 'PRIVATE_ALERT_API_KEY'; alertUrl="https://api.thingspeak.com/alerts/send"; options = weboptions("HeaderFields", ["ThingSpeak-Alerts-API-Key", alertApiKey ]); temperature = thingSpeakRead(channelID,'NumDays',30,'Fields',1); recentvalue = temperature(end) alertSubject = sprintf("Temperature Alert"); alertBody = sprintf(" The temperature of the customer entering the store is high : ",recentvalue); if recentvalue > 32 webwrite(alertUrl , "body", alertBody, "subject", alertSubject, options); end Basically the other articles tell me that I have to enter a delay or a pause because the free version of thingspeak has limitations. Any idea on what I could do to make sure the code runs with minimal amount of delay?
Tanusree in MATLAB Answers
上次活动时间: 2024-4-30

Everytime I want to execute the following programming on ThingSpeak Matlab Analysis, facing problem with thingSpeakWrite, and it is showing ''Expected a string scalar or character vector for the parameter name'' error. Also how can I write every data instead of single data to write channel on ThingSpeak? % Read the most recent data from the source channel data = thingSpeakRead(readChannelID, 'ReadKey', readAPIKey, 'Fields', [1, 2], 'NumPoints', 7); % Extract the values from the read data values1 = data(:, 1) % Values from field 1 values2 = data(:, 2) % Values from field 2 % Write the data to the destination channel thingSpeakWrite(writeChannelID, 'WriteKey', writeAPIKey, [values1, values2], 'Fields', [1, 2]);
Sebastian Romero del villar in MATLAB Answers
上次活动时间: 2024-2-20

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 ) https://thingspeak.com/channels/1341385/charts/3?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=60&type=line&update=15 (PD I didnt find similar topics from community) Thank You!
Christoffer Veng in MATLAB Answers
上次活动时间: 2023-9-22

So I've made a small weather thingy that reports various data to ThingSpeak. How will I go about making a Matlab Analysis that finds daily rainfall at midnight? The counter and hence the data is an ever growing variable (mm)... I'm in all aspects of the word new to this Matlab thing but I did search for answers before asking this question. Examples or links to existing working code would be much appreciated. Kind regards, Chris
William Glass in Discussions
上次活动时间: 2022-5-4

Hello I am trying to run the example code for "Calculate and display average humidity" using my channel data. I filled in the blanks: readChannelID humidityFieldID NumMinutes=720 The program returns display(avgHumidity,'Average Humidity') with "NAN" instead of the correct average. I have a free ThingSpeak account but have been following temperature & humidity every hour for the last 9 months. I would also like to store this average value on the same channel on a new field. Can anyone help me? Thank You Apps Matlab Analysis receiving NAN to "Calculate and display average humidity" Is your channel public? If so, can you share the ID and we can have a look. If not, can you share the data from the last 720 minutes in your channel and we can see it? To show the data, you can use the REST API https://api.thingspeak.com/channels/CHANNELID/feeds.json?api_key=APIKEY&munutes=720 or thingSPeakRead data = thingSpeakRead(CHANNELID,ReadKey='channel Read API key', 'outputformat', 'timetable) If you put the thingSpeakRead command in a MATLAB analysis and leave the semicolon off the end, it will show you the output. Thank you. I removed the semicolon to see what was happening. In fact, I am logging 3 fields at time1 and 3 other fields at time2. It's information coming from 2 sensors at 2 different times. Time1 values were sent to fields 1,2,3 at 23:42:50 Friday and Time2 values to fields 4,5,6 at 00:10:37 Saturday. (See example below). Apparently the channel needs all 6 fields at the same time?? Ven 04/03/2022 23:42:50 AT+CIPSEND=0,102 GET https://api.thingspeak.com/update?api_key=1C283SDWBZQ1FP83&field1=8.22&field2=72.61&field3=337 Sam 05/03/2022 00:10:37 AT+CIPSEND=0,103 GET https://api.thingspeak.com/update?api_key=1C283SDWBZQ1FP83&field4=11.81&field5=1.8&field6=505 yes, every entry in the feeds table sets a null response to all fields that arent populated simultaneously. So if you dont send them at the same time, there will be some unexpected effects. We would expect sensors that do not post at the same time to use a seperate channel. That way your field plots will work as expected. OK. I understand. I did it like that to have a centralized view of all data on the same graphset for covenience. It's been working fine like that. The null values are just ignored on the graph. I wanted to do a moving average on one of the fields. I'll do it with my Arduino using a 1st order recursive lowpass filter and put it on an additional field. Thank you. You can use MATLAB visualizations to summarize results from other channels and add that you the other channel, or you can plot multiple channels data on a single plot. You can also use MATLAB to remove the NAN values in the data you have and show the actual average. In that case, the cleanest way seems to be: Create 2 channels for my 2 sensors. Create a 3rd channel for my average results on channel 2, field2. Plot the 3 channels on a single plot. Since channel 1 will not be synchronized with channel 2 and 3, will the single plot still work? Thank you for your help! Yes you can read from both channels to create your display. You will have to be a little thoughtful about how you combine the data. Here is an example where you read data from three different days and plot it on the same axis. You can also use tiledlayout to create multiple axis plots in the same figure. To regularly create the average, you can use timecontrol to schedule the code. If you become channel constrained, you can calculate the average when you build the plot instead of writing it to a new channel. You wont need to save the average results since they are dependant on the existing data. Another posibility wopuld be to write sensor 1 and two measurements to the third channel at the same time. You can use retime to syncronize the time stamps (if you read the data into a timetable). Then the standard field plots in the third, derived channel, will work. This depends on how far apart in time the readings are. To fill in the data, you could use the last value of sensor 1 when sensor 2 has a reading, or the moving average. there are name value pairs in the retime function to do that. MATLAB gives you lots of choices. Wow! An impressive toolset! You've opened up a new door for me to discover the Matlab Wonderland! Thanks! So, I finally chose the solution which economizes rework on my 2 Arduino prototype programs. I used the example in Matlab analysis, "Replace missing values in data". I analyzed my 6 channelID 1418147 fields to get the latest 1 (or 10) non NAN entries, calculated the mean on 10 values of my pool water level, then posted the time resynchronized 7 fields to channelID 1722490. I perform the analysis slightly more frequently than I do for my fastest sensor so not to skip any data. It works like a charm! Thanks for your help! I appreciate you letting us know and I'm really glad to hear it worked for you! If you have time to check in here at the community again, we love for you to pass on some of your new ThingSpeak and MATLAB skills. matlab analysis average humidity nan same channel apps
Sreehari M V in Discussions
上次活动时间: 2021-3-19

An error occurred while executing the code. I was referring this site : https://in.mathworks.com/help/thingspeak/monitor-channel-inactivity-using-multiple-thingSpeak-apps.html While executing the code Error using matlab.internal.webservices.HTTPConnector/copyContentToByteArray (line 373) The server returned the status 400 with message "Bad Request" in response to the request to URL https://api.thingspeak.com/apps/thinghttp/send_request?3DOHBYUXDXD4OVIV=WA327EPXB1DWM0FA. Error in readContentFromWebService (line 46) byteArray = copyContentToByteArray(connection); Error in webread (line 125) [varargout{1:nargout}] = readContentFromWebService(connection, options); Error in Custom (no starter code) 2 (line 3) Trigger_TalkBack = webread(url,'3DOHBYUXDXD4OVIV',ThingHTTP_APIKEYS.To_Trigger_TalkBack) %Trigger TalkBack via ThingHTTP This is been showing My Code : ThingHTTP_APIKEYS = struct('To_Trigger_TalkBack','WA327EPXB1DWM0FA');% Your ThingHTTP app API keys url = 'https://api.thingspeak.com/apps/thinghttp/send_request'; Trigger_TalkBack = webread(url,'3DOHBYUXDXD4OVIV',ThingHTTP_APIKEYS.To_Trigger_TalkBack) %Trigger TalkBack via ThingHTTP Error while executing the code Can you describe what you expect this code to do? I see that you are triggering ThingHTTP, are you trying to give the ThingHTTP api keys for a talkback? Why not just read the talkback directly? webread(url,'3DOHBYUXDXD4OVIV',ThingHTTP_APIKEYS.To_Trigger_TalkBack) %Trigger TalkBack via ThingHTTP iot matlab analysis talkback
Aniket Manjare in MATLAB Answers
上次活动时间: 2021-1-22

Kindly suggest me to solve this Error in MATLABAnalysis>getValues (line 63) healthIndicator = ((selectedFeatures{:,:} - T.meanTrain{failureMode}) ./ T.sdTrain{failureMode} * T.pcaCoeff{failureMode}(:, 1));
Esmaeil Chehrehnama in MATLAB Answers
上次活动时间: 2020-7-23

Hi I used this code to show last 20 field1 datas in field2 chart: % Enter your MATLAB Code below readChId = XXX; readKey = 'XXXXX'; writeChId = YYY; writeKey = 'YYYYY'; [Data,t] = thingSpeakRead(readChId,'Fields',1,'NumPoints',20,'readkey',readKey); thingSpeakWrite(writeChId,Data,'Fields',2,'Timestamps',t,'Writekey',writeKey); display (Data) when i click save an run i can see Data in output box but i can't see anything in field2 chart! i activate timecontrol for every 30 minuts but still i can't see any data in field2 chart :( what is my problem?
Sendhoran Manokaran in MATLAB Answers
上次活动时间: 2020-4-26

Hi i am wondering isit possible for me to send multiple emails to different people? I have already been able to send an email to myself personally using the Matlab analysis but i was wondering if i could do this with other email addresses? What i mean is that if ,my data goes beyond a limit my React function notfies this data change and sends the MATLAB analysis portion to send an email to me and another personnal. Pls do tell me if this is possible and if so, please do tell me how this can be done Thank you

关于 ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.