# Create time matrix with serial date number and sample rate

11 vues (au cours des 30 derniers jours)
Marpe le 20 Juil 2022
Commenté : Marpe le 28 Juil 2022
Hello everyone,
I recorded ECG measurements on animals and want to analyse them on Matlab.
The software I'm using (LabChart) enables me to load the data as different vectors in matrix form. Everything is explained here : https://www.adinstruments.com/support/knowledge-base/how-does-matlab-open-exported-data.
My problem is:
I want to create a new matrix of the time but I have no idea how.
I know I can create a time array with the serial date number Labchart uploaded with this code:
t1 = datetime (blocktimes, 'ConvertFrom', 'datenum', 'Format', 'HH:mm:ss');
But this number is only for the first data point and I would like to have the time for my whole data set.
As I have the tick rate, sample rate and total number of data points I guess it's possible.
Any idea?
Thanks,
Marine
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

dpb le 20 Juil 2022
Well, what is "tick rate"?
If you have a sample rate and number of points, then the sample times are just
t=[0:1/Fs:(N-1)/FS];
where Fs is sample rate (Hz) and N is number of samples.
In MATLAB, the above will be a an array of doubles, you can cast to a duration with seconds() and add to the initial time to get actual sampling times. But, for signal analysis, absolute time is rarely of real interest.
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Marpe le 28 Juil 2022
This helped me a lot thank you! I am really new to Matlab and I'm learning almost by myself so simple things like this is not obvious for me :)

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Birthdays dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by