Date/time plot

5 visualizaciones (últimos 30 días)
Iacopo
Iacopo el 11 de Mayo de 2022
Comentada: dpb el 11 de Mayo de 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 comentario
dpb
dpb el 11 de Mayo de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by