MATLAB: Date time convert to elapsed time

etimetime

I have a vector of date times in 'HH:MM:SS' format which I want to convert to elapsed time. Each cell is a 1 minute increment from the previous.
Right now I'm doing a for loop that loops the size of the entire vector, and does x(i)-x(1) to calculate the elapsed time (in minutes).
This seems kind of cumbersome code, and I feel like there's an easier way. Any recommendations?

Best Answer

your cell array
c={'12:00:00' '12:00:01' '12:00:02' '12:00:03'}
d=datenum(c,'HH:MM:SS')
out=d-d(1);
time_sec=out*86400