Find corresponding element in same row as given value in matrix

32 ビュー (過去 30 日間)
nogooduser
nogooduser 2022 年 1 月 15 日
コメント済み: nogooduser 2022 年 1 月 18 日
Hi there,
I am working with two column matrices. The matrices pull data from external files. Both matrices show basically one column corresponding to an x variable and one column corresponding to a y variable. The matrices share the same x variables and different y variables. I would like to:
  1. Find maximum y value in 1 of the column matrices.
  2. Use x value corresponding to max y value in matrix 1 to find y value in matrix 2.
Thank you in advance.

採用された回答

Stephen23
Stephen23 2022 年 1 月 15 日
Assuming that A and B are you matrices, and that the Y values are in the second columns:
[valA,idx] = max(A(:,2))
valB = B(idx,2)

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by