Converting time to sample numbers

5 visualizaciones (últimos 30 días)
Sunil
Sunil el 6 de Oct. de 2017
Comentada: Sowmya MR el 7 de Oct. de 2017
Hi,
I have an ECG recording which is approximately 2 days long. The time stamps are continuous (after 24hrs it becomes 25hr and so on). Now i have a start time of the recording, length of the data and sampling frequency. Is it possible to create a time vector using this?
Lets say: Fs=250Hz, Start time = 08:33:05 and total length of the data is 28hours?

Respuesta aceptada

Cam Salzberger
Cam Salzberger el 6 de Oct. de 2017
Hello Sunil,
Quite easily actually. Just convert the start time to a datetime, and then add the timesteps as duration values to the initial time. Something like:
startTime = datetime('08:33:05'); % Defaults to today's date, but you can add a date
Fs = 250; % Hz
period = 1/Fs; % seconds
timesteps = startTime+seconds(0:period:28*60*60*Fs);
Now the issue is that the datetime array would be 6300000001 elements long, which is generally too much memory. So depending on what you want to do with it, I'd suggest creating it in smaller segments and writing it to a file or manipulating data with that.
-Cam

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by