フィルターのクリア

how to find time difference (in seconds) using matlab serial date number

23 ビュー (過去 30 日間)
Max Bernstein
Max Bernstein 2015 年 6 月 4 日
コメント済み: Walter Roberson 2015 年 6 月 4 日
Hello,
I have data obtained in matlab serial date number and I would like to convert them to seconds. Once I have them in seconds, I can calculate the time lapsed since the start of the measurement and plot it. Example of the data is:
[event_stamp, chan_mean] = [731895.4861, 0.696762; 731896.4097, 0.917459; 731896.5938, 0.678536; 731896.6771, 0.58941; 731953.4583, 1.09193]
Desired result [time[s], data] = [0, 0.696762; 1.2, 0.917459; 3.1, 0.678536; 4.5, 0.58941; 10, 1.09193]
thanks for your help!

回答 (2 件)

Walter Roberson
Walter Roberson 2015 年 6 月 4 日
lapsed_seconds = (YourData(:,1) - Yourdata(1,1)) * 24 * 60 * 60;

Max Bernstein
Max Bernstein 2015 年 6 月 4 日
Thanks for your help, but dont I need to convert the serial date number to second first somehow?
  2 件のコメント
Guillaume
Guillaume 2015 年 6 月 4 日
Multiplying a date number by 24 (hours/day) x 60 (minutes/hour) x 60 (seconds/minute) will convert it to seconds.
Walter Roberson
Walter Roberson 2015 年 6 月 4 日
You do not need to convert to seconds and then subtract. You can subtract and then convert to seconds.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by