intersection between two arrays of objects

I have two arrays of objects:
user and usersActive
I want to find the intersection between these to arrays based on a property (the id) of the objects in these arrays
Example:
user = [ user(1) user(2) ... user(n)]
usersActive = [user(1) user(2) ... user(p)]
(p<n)
user(j).id in user is equal to user(k).id in usersActive, so on and so forth.
after that, I want to change the user(j).id in user by user(k).id usersActive

回答 (1 件)

Star Strider
Star Strider 2019 年 1 月 17 日

0 投票

See if the intersect (link) funciton will do what you want.

カテゴリ

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

タグ

質問済み:

2019 年 1 月 17 日

回答済み:

2019 年 1 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by