テーブルの日時が重複する行を削除したい

28 views (last 30 days)
Yu
Yu on 1 Sep 2021
Commented: Yu on 1 Sep 2021
こんにちは。
添付のsampleの5列目にタイムスタンプ(timestamp_JST)があり、これが重複している行を削除したいのですが上手くいきません。
良い方法をご存知の方がいらっしゃいましたらご教示ください。

Accepted Answer

Atsushi Ueno
Atsushi Ueno on 1 Sep 2021
load('sample1.mat');
[~,ia] = unique(sample1.timestamp_JST,'stable');
B = sample1(ia,:)
B = 5×5 table
GPS_fix GPS_date GPS_time GPS_milliseconds timestamp_JST _______ ___________________ ___________________ ________________ ___________________ 0 2021/07/03 00:00:00 2021/09/01 23:44:35 162 2021/07/04 08:44:35 2 2021/07/03 00:00:00 2021/09/01 23:44:36 162 2021/07/04 08:44:36 4 2021/07/03 00:00:00 2021/09/01 23:44:37 162 2021/07/04 08:44:37 6 2021/07/03 00:00:00 2021/09/01 23:44:38 162 2021/07/04 08:44:38 8 2021/07/03 00:00:00 2021/09/01 23:44:39 162 2021/07/04 08:44:39
  1 Comment
Yu
Yu on 1 Sep 2021
早速ありがとうございます!
なるほど、uniqueでtimestamp_JST列の一意の変数の行インデックスを検索するということですね。
[~,] の意味も勉強になりました。
ありがとうございました!

Sign in to comment.

More Answers (0)

Categories

Find more on 行列および配列 in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!