Date/time plot

5 vues (au cours des 30 derniers jours)
Iacopo
Iacopo le 11 Mai 2022
Commenté : dpb le 11 Mai 2022
Hi all,
I would like to change the xlabel of my plot from samples to seconds. The plot I make is a recording from an instrument.
I managed to get the start date from the text file header (in datetime format).
Now I would like to display in the x-axis of my plot the date and time in seconds (and then hours, days and date) instead of samples (which is the first column of my text file).
I attached my file for you to see.
Thanks to anyone who will help me.
  1 commentaire
dpb
dpb le 11 Mai 2022
Your first column is in some unit of time; one presumes seconds relative to the date stamp at the header, (at least approximately, we have no idea whether that datestamp actuall represents the trigger time or was when the file was written after the acquisition or sometime before with an undetermined delay before trigger).
Anyways, that aside,
tYourData.SampleTime=theStartDateTimeYouGot+seconds(tYourData.Time);
will give you a datetime variable that is that time vector.
Plotting against it will give you a datetimeRuler x axis which you can format as desired. It will be clumsy; it takes a lot of space to write date labels, but it will do it.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Dates and Time 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