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

조회 수: 13 (최근 30일)
Akul Satish
Akul Satish 2018년 6월 9일
편집: per isakson 2018년 6월 10일

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!!

채택된 답변

Image Analyst
Image Analyst 2018년 6월 10일
Use ismember().

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by