Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: find all numbers in a vector
Replies: 4   Last Post: Dec 3, 2012 10:24 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 5,605
Registered: 2/7/05
Re: find all numbers in a vector
Posted: Dec 3, 2012 8:18 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 12/3/2012 6:07 PM, Petra wrote:
> Hi all,
> I cant find a solution without a loop for this problem:
> I got 2 vectors
> a=[2 3 14 15 16 17 18 33 34 35]
> b=[17 18 35 60 61 62]
> and I try to find all numbers and position in a which are in b.
> The answer should be: 6 7 8 10
> Thanks for help
>


You answer is wrong. Here is the correct answer

EDU>> find(ismember(a,b)==1)

ans =

6 7 10





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.