Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 472.8k

How to solve unrecognized function or variable in Matlab

Jan 13 2020 3:30 AM
Hi Team
 
I have this error on my Matlab and cant seem to solve it. "Unrecognised function or variable 'avg_temperature'. My code is below and i am following this link to create an email alert to my channel;
 
https://www.mathworks.com/help/thingspeak/sendalert.html
data = thingSpeakRead(929272, "NumMinutes", 100);
aveTemp = mean(data(:,3));
apiKey = 'O6P4N8AVZWKNGK5U';
alertURL = "https://api.thingspeak.com/alerts/send";
options = weboptions("HeaderFields",["ThingSpeak-Alerts-API-Key", apiKey]);
alertBody = sprintf("The temperature is %0.2fF.", aveTemp);
alertSubject = sprintf("! Temperature exceeded 60.0F!");
if avg_temperature > 60.0 webwrite(alertURL, "body", alertBody, "subject", alertSubject, options);
end

Answers (1)