Date/time plot

조회 수: 5 (최근 30일)
Iacopo
Iacopo 2022년 5월 11일
댓글: dpb 2022년 5월 11일
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
dpb
dpb 2022년 5월 11일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by