How to find the common values in two arrays

816 次查看(过去 30 天)
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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Types 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by