MATLAB: Reading from Thingspeak: Daily averages are easy. How to get a monthly average

averagedailygetmonthlyrestThingSpeak

I use the REST API to read data from Thingspeak and this works well:
This request correctly returns one value per day. However I need a monthly average – a single value per month. Ideally something like:
Is there a way to achieve something like this?

Best Answer

There are built in template codes to help you develop MATLAB code. If you go to the MATLAB analysis or MATLAB Visualizations apps, you can select from the templates after choosing to create a new instance of the app.
Here is a tutorial for using one of the templates to calculate averages.:
For your example, I think you will proably want to preprocess the data and store it in another channel. Reads are limited to 8000 points, so you want be able to read all the data in a single call.
I would reccomend writing a script that reads the data and writes the daily avaerages to another channel. Then your Mobile app can read the values or call the charts API for the derived channel. Going forward, you can set a timeControl to write that daily average to the derived channel every day (as Vinod suggested). Historicall you may have to process them in a few batches.
I can provide more details if you get stuck with the code.