How can I get successive difference and later add all the difference?

1 回表示 (過去 30 日間)
Devansh Patel
Devansh Patel 2018 年 6 月 14 日
コメント済み: Devansh Patel 2018 年 6 月 14 日
735954.715277778 735954.716412037 735954.717766204 735954.717824074 735954.717916667 735954.863611111 735955.043206019 735955.043773148 735969.629212963 735969.629421296 735969.634259259 735969.743506944 735969.744884259 735969.745000000 735969.745590278 735969.745949074 735969.749062500 735969.818958333 735969.826678241 735969.826793982......
These are the timestamps. I want difference between successive timestamps like (2-1) second minus first, fourth minus third (4-3) and so on and add the difference.I want final result in minutes. Like (2-1)+(4-3)+(6-5)...... Any Suggestions on how to solve it?

採用された回答

Paolo
Paolo 2018 年 6 月 14 日
編集済み: Paolo 2018 年 6 月 14 日
x = [735954.715277778 735954.716412037 735954.717766204 735954.717824074 735954.717916667 735954.863611111 735955.043206019 735955.043773148];
x = diff(x);
d = sum(x(1:2:end));
[~,~,~,h, mn, s] = datevec(datetime(d,'ConvertFrom','datenum','Format','hh:mm:ss'));
dmin = h*60+mn+s/60;
dmin =
212.333330729167
  6 件のコメント
Paolo
Paolo 2018 年 6 月 14 日
編集済み: Paolo 2018 年 6 月 14 日
I've edited my answer.
Devansh Patel
Devansh Patel 2018 年 6 月 14 日
Hey it worked like magic. Thanks

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

その他の回答 (0 件)

カテゴリ

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