Analysing hourly data over a year

4 views (last 30 days)
Alexander Flyckt
Alexander Flyckt on 20 Oct 2017
Edited: KL on 20 Oct 2017
Hi,
I am working with data over electrical import/export from the grid and production (buildings with consumption and production from solar panels on the roof). I have data points every hour for a full year and plotting this results in a somewhat messy plot. What I really would like to do is be able to look at the data weekly and also in an easy way step from the first week to the last through the full year. For particular cases, zooming in on a day is also of interest. I would also be interested in being able to turn some of the data on and off.
What I ended up doing was starting to build a GUI system with these functions which works somewhat nice. Still some things to work on. However, since this cannot be a unique task of analytics, is there any builtin functions or great tools to use for this? Or maybe this can this be achieved with the standard subplot tools in an easy way?
I'll attach one of the tables as an example.

Accepted Answer

KL
KL on 20 Oct 2017
Edited: KL on 20 Oct 2017
Yes, there is. To play with such time based measurements, especially for data over such long duration, you could use a time table. But you need 2016b or later. If you have that, your job is so much easier.
Import your csv file as table and then create a timetable from it .Then you can do whatever you want to do with it, like monthly mean, yearly sum, etc. For example,
data_table = readtable('yourfile.csv');
data_timetable = table2timetable(data_table);
and then you could use retime to do hourly, monthly, weekly and all sorts of such analytics. https://www.mathworks.com/help/matlab/ref/retime.html
hourly_mean_table = retime(data_timetable,'hourly','mean')
Since you're already working on a GUI, you can add couple of pushbuttons and checkboxes to leverage these functions.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!