Converting time to sample numbers
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sunil
am 6 Okt. 2017
Kommentiert: Sowmya MR
am 7 Okt. 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?
0 Kommentare
Akzeptierte Antwort
Cam Salzberger
am 6 Okt. 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
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!