finding all instances in a vector
Show older comments
Hi all,
is there an easy way to find all instances of, say, numbers in vector x in a target vector, y?
For example, if I have a vector x which is: [ 1 4 10 ] how do i find all 1's 4's and 10's in y: [ 1 2 3 4 5 6 7 8 9 10 ]
sorry if this is a basic question.. i could write a for-loop of course, but i imagine there must be a more elegant way to do this. Thanks in advance!
2 Comments
Liz
on 21 Jul 2011
the cyclist
on 21 Jul 2011
No problem that this is a basic question! You asked it clearly and specifically, with an example of what you wanted. Good question.
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!