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 Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by