フィルターのクリア

Linking two sets of data to be in line with eachother

1 回表示 (過去 30 日間)
Cameron Hudspith
Cameron Hudspith 2023 年 10 月 15 日
回答済み: Cameron Hudspith 2023 年 10 月 16 日
Hey, I have two tables, each with a column for load and position. I'm hoping to use one set of load data, to search the other table for the nearest load value and extract it's relative position. I would then subtract that position from the original tables position (likely into a new array).
I believe this should be done with indexing, but I'm pretty confused on the subject (especially considering the load values aren't exactly equal, I just need to index to the cloest value)
Any tips would be helpful!

採用された回答

Cameron Hudspith
Cameron Hudspith 2023 年 10 月 16 日
The following function is the solution to my problem. I was able to put it into a loop to apply the result to every row of my dataset. Thanks to everyone who helped.
[~,idx] = min(abs(PressingPlate_FP{:,"LoadN"}-Control_FP{i,"LoadN"}));
result = PressingPlate_FP{idx, "Positionmm"};

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 10 月 15 日
Perhaps
idx = interp1(loadValues1, 1:numel(loadValues1), loadValues2, 'nearest')
  1 件のコメント
Cameron Hudspith
Cameron Hudspith 2023 年 10 月 16 日
I believe that is on the right track, but I can't get the function to work
i=1;
idx = interp1(PressingPlate_FP(:,"LoadN"), PressingPlate_FP(:,"Positionmm"), Control_FP{i,"LoadN"}, 'nearest');
In that code I'm hoping interp1 will search the load column of the PressingPlate_FP table for the nearest value to Control_FP{i,"LoadN"}, then return The value of the position column of PressingPlate_FP directly next to the load value
The function is currently giving me an error

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

カテゴリ

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

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by