simple question of creating a time vector

12 views (last 30 days)
hello everyone,
i have a data set of 15345 samples, duration of 60 seconds, and sample frequency of 256 hz , how do i create the right time vector ?
i have tried to use : t=0:1/fs:1 and it wasnt correct, (fs being 256)
any suggetion would be helpful. thanks in advance:)

Accepted Answer

Star Strider
Star Strider on 7 Aug 2020
Without the exact details of your file (that I suspect is not exactly 60 seconds long), something like this will work:
t = linspace(0, 60, 15345);
Note that this provides a sampling frequency of 255.73 Hz, so it may need to be tweaked a bit to get exactly the 256 Hz sampling frequency.
Calculating:
seconds = 15345/256
produces:
seconds =
59.9414
so you may want to check the actual duration.
.

More Answers (0)

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!