Can i compare two channels
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello
I have lakewater temperature metering buoy. Last year has own channel from may to december. This year measuring starts few weeks ago and they have own channel. Can i compare these two channel like at this example:https://se.mathworks.com/help/thingspeak/Compare-Temperature-Data-from-Three-Different-Days.html Showing this day and yesterday and the same period at last year?
Réponses (1)
Christopher Stapels
le 19 Mai 2022
You definitely can as long as there is data in your channel. Change the part of the code from days(1) to years(1). your final code will depend on how long you want to read data for.(in this case the span of data is one day).
buoyToday = thingSpeakRead(readChannelID,'Fields',TemperatureFieldID,'dateRange',...
[datetime('today')-days(1),datetime('today')],'ReadKey',readAPIKey);
buoyLastYear = thingSpeakRead(readChannelID,'Fields',TemperatureFieldID,'dateRange',...
[datetime('today')-yeats(1)-days(1),datetime('today')-years(1)],'ReadKey',readAPIKey);
Then be sure to change the places where temperatureDay1 is referenced to whatever you call the new data. In this case I used buoyToday nad buoyLastYear.
Communautés
Plus de réponses dans ThingSpeak Community
Voir également
Catégories
En savoir plus sur Read Data from Channel dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!