TYL
TYL

Reputation: 1637

Finding mean of timestamp data in Matlab

I have a data of time (in char) in which a particular event occurs and I want to find the mean of the time. For e.g.,

a = ['8:00 am'; '8:10 am'; '8:20 am'; '8:30 am'];

The output should be 8:15 am. Thanks!

Upvotes: 0

Views: 41

Answers (1)

TYL
TYL

Reputation: 1637

I managed to come up with the solution.

a = ['8:00 am'; '8:10 am'; '8:20 am'; '8:30 am'];
b = datestr(mean(datenum(a)), 'HH:MM PM');

Upvotes: 1

Related Questions