Effacer les filtres
Effacer les filtres

How to find the common values in two arrays

813 vues (au cours des 30 derniers jours)
Jisha
Jisha le 28 Mai 2012
Commenté : Dyuman Joshi le 8 Mai 2024
Suppose I have two vectors
a= 1 2 3 4
b= 4 5 6 7 9
How do I find which value is common to both
in above case it is 4

Réponse acceptée

Thomas
Thomas le 28 Mai 2012
You need the intersect command
doc intersect
in your case
[val,pos]=intersect(a,b) % gives common val and its position in 'a'

Plus de réponses (0)

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by