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 comentarios

Luna
Luna el 27 de Mzo. de 2019
Editada: Luna el 28 de Mzo. de 2019
Moved this comment to answers.
Jan
Jan el 27 de Mzo. de 2019
@Luna: If this is posted in the section for answers, I will vote for it.
EDEN
EDEN el 27 de Mzo. de 2019
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 el 27 de Mzo. de 2019
As Luna suggested, use ismember().
EDEN
EDEN el 27 de Mzo. de 2019
thanks
Luna
Luna el 28 de Mzo. de 2019
@Jan waiting for your +1 :)

Iniciar sesión para comentar.

 Respuesta aceptada

Luna
Luna el 28 de Mzo. de 2019

1 voto

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 comentarios

Adam Danz
Adam Danz el 28 de Mzo. de 2019
+1
Luna
Luna el 29 de Mzo. de 2019
Thanks @Adam :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 27 de Mzo. de 2019

Comentada:

el 29 de Mzo. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by