How to Calculate sum of entries "NumDays 10". i need help, i want to calculate total entries in 10 days and display. here's the code.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Aman Kumar
am 26 Mai 2020
Beantwortet: Christopher Stapels
am 27 Mai 2020
readChannelID = 1035265;
outputliquidqantityFieldID = 3;
readAPIKey = '';
meter_reading = thingSpeakRead(readChannelID,'Fields', outputliquidqantityFieldID,'NumDays',10,'ReadKey',readAPIKey);
% Calculate the Cost
Billing_cost = sum(meter_reading);
display(Billing_cost,'Total Billing Cost (INR)');
% Start by setting the channel ID and Alert key. All alert key start with TAK.
formatSpec = "The Water consumption bill is: %d,%d";
A1 = sum(meter_reading);
A2 = meter_reading
apiKey = 'TAK14ZOZGAXZQMR05';
alertURL = "https://api.thingspeak.com/alerts/send";
options = weboptions("HeaderFields", ["ThingSpeak-Alerts-API-Key", apiKey ]);
alertBody = sprintf(formatSpec,A1,A2)
alertSubject = sprintf(" Water consumption exceeded 100 l!");
if meter_reading >= 100
webwrite(alertURL, "body", alertBody, "subject", alertSubject, options);
end
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Communitys
Weitere Antworten in ThingSpeak Community
Siehe auch
Kategorien
Mehr zu ThingSpeak 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!