Lookup values in ranges of a table and copy a corresponding output value in another table

3 ビュー (過去 30 日間)
Hi,
I'm trying find 'Val' value from table A given by Lap number in table B from minimum of first 3 rows coresponding to each lap in table A (with no sorting).
The answer would be in Table B:
Lap Val
1 1
2 0
5 0
Thanks.

採用された回答

Voss
Voss 2022 年 8 月 22 日
A = load('A')
A = struct with fields:
Events: [104×2 table]
B = load('B')
B = struct with fields:
Events: [3×1 table]
[~,idx] = ismember(B.Events.Lap,A.Events.Lap);
result = A.Events(idx,:)
result = 3×2 table
Lap Var ___ ___ 1 1 2 0 5 0
  11 件のコメント
Gabi
Gabi 2022 年 8 月 29 日
Thanks for your help, this is all clear now.
Voss
Voss 2022 年 8 月 29 日
Excellent. You're welcome!

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by