Converting time to sample numbers
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponse acceptée
Cam Salzberger
le 6 Oct 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
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!