HEEEEELP....... Array cells comparing....

Hello friends. i want to compare elements in two two arrays, one is big the other is smaller so i need to check if an individual element (say elements one of the smaller array) is available in the bigger one. Any one who can help me perform that job i would really appreciate.

댓글 수: 6

Luna
Luna 2019년 3월 27일
편집: Luna 2019년 3월 28일
Moved this comment to answers.
Jan
Jan 2019년 3월 27일
@Luna: If this is posted in the section for answers, I will vote for it.
EDEN
EDEN 2019년 3월 27일
arr1=[2 1 4 1 5 9 2 6 5 3 5 8 9 7 9 ]
arr2=[2 ]
arr2 contains just one element '2'. we need to check if arr1 contains any number in arr2 and if yes we take it and save it in an other variable. that is precisely what i want.
Adam Danz
Adam Danz 2019년 3월 27일
As Luna suggested, use ismember().
EDEN
EDEN 2019년 3월 27일
thanks
Luna
Luna 2019년 3월 28일
@Jan waiting for your +1 :)

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

 채택된 답변

Luna
Luna 2019년 3월 28일

1 개 추천

Hi,
Look at the function ismember to search if your element exists in another array.
Please share your arrays as an example and what have you done so far, and what kind of output you want to get. So that we can help.

댓글 수: 2

Adam Danz
Adam Danz 2019년 3월 28일
+1
Luna
Luna 2019년 3월 29일
Thanks @Adam :)

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2019년 3월 27일

댓글:

2019년 3월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by