Finding corresponding values between vectors

umps_land is a vector and a subset of vector umps. The subset was selected graphically using the brush. vmps is a vector the same size as umps. I want to (non-graphically) find the values of vmps that correspond to umps_land and call it vmps_land. How do I accomplish this seemingly easy operation? (and why can't I find documentation on this??)

4 件のコメント

Rong Yu
Rong Yu 2015 年 6 月 10 日
Try ismember
index = ismember(umps,umps_land);
vmps_land = vmps(index);
Kirby Runyon
Kirby Runyon 2015 年 6 月 11 日
Thanks, Rong Yu. That seems to have worked!
Guillaume
Guillaume 2015 年 6 月 11 日
@Rong Yu, in the future post your answer as an answer rather than a comment to the question. That way the OP can accept your answer and you get reputation.
Rong Yu
Rong Yu 2015 年 6 月 11 日
Thank you, Guillaume! I put my suggestion into the answer.

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

 採用された回答

Rong Yu
Rong Yu 2015 年 6 月 11 日

0 投票

Try ismember
index = ismember(umps,umps_land);
vmps_land = vmps(index);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2015 年 6 月 10 日

回答済み:

2015 年 6 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by