How do I find elements of one array in another array?

15 vues (au cours des 30 derniers jours)
Akul Satish
Akul Satish le 9 Juin 2018
Modifié(e) : per isakson le 10 Juin 2018

Here are my example arrays:

A1 =                               
    {'Cheating'         }          
    {'Discount stealing'}
    {'Traffic Cones'    }
A2 = {'Skipping Work'                         }
    {'Accidental Betrayal '                  }
    {'Traffic Cones'                         }
    {'Cheating'                              }
    {'Discount Stealing'                     }
    {'Office Space'                          }
    {'Drowning Baby'                         }
    {'Giving tuesday'                        }
    {'Helping Little Old Lady With Groceries'}
    {'Lady Fell'                             }
    {'Underground Baggage'                   }
    {'Canteen Ladies'                        }

I would like to find the indices in A2 that have the elements of A1 and save these indices in a variable 'match_indx'.

Thank you!!

Réponse acceptée

Image Analyst
Image Analyst le 10 Juin 2018
Use ismember().

Plus de réponses (0)

Catégories

En savoir plus sur Data Import and Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by