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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by