Borrar filtros
Borrar filtros

How to find the common values in two arrays

813 visualizaciones (últimos 30 días)
Jisha
Jisha el 28 de Mayo de 2012
Comentada: Dyuman Joshi el 8 de Mayo de 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

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Data Types en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by