convert epoch time(timestamps) into 30 minutes average bin?

Hi,
I have a data file (of dimension 2195x56) for one day with 30 seconds interval (some data are missing). first column is the timestamps. I have to calculate data binned into 30 minutes average. I know "discretize" should work but I have timestamps. I tried using "discretize" but it shows that "discretize" should have numeric or logical. Can any one help. I have Matlab2015b. My code is below.
axy=importdata('data.txt');
time_st=axy(:,1);data=axy(:,2:end);
edges = datetime(2020,4,17,0,0:30:1440,24)';
bin = discretize(data,edges,edges(1:end-1));

5 Comments

Convert to a timetable and use
doc retime
I have Matlab2015b, so retime doesnot work.
Sorry, I got distracted and never got back as intended...
Looks to me as though you would need to translate the timestamp in the file to real time and I can't decipher what it must be in, but there also aren't enough significant digits in your data to make the entries unique.
If one just assumes a uniform time vector as your generated time does, then there's no correlation left to the actual timestamp of each record in the file and you may as well just divide it up by the assumed sampling rate; you can't tell who is/isn't missing any longer. You need the actual timestamps to do that.
Ok..Thank you.. I "ll do it..
dpb
dpb on 19 Jun 2021
Edited: dpb on 19 Jun 2021
What is the conversion to real time from those timestamps?
And is there another repository for the data still that might have the full precision instead of having been written to the csv file with limited significant digits? That'd be the cat's meow to be able to do it as would want ideally...

Sign in to comment.

Answers (0)

Categories

Asked:

on 17 Jun 2021

Edited:

dpb
on 19 Jun 2021

Community Treasure Hunt

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

Start Hunting!