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: seacrhing/indexing a vector
Replies: 3   Last Post: Jul 6, 2012 9:25 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Daniel Robbins

Posts: 27
Registered: 6/12/12
seacrhing/indexing a vector
Posted: Jul 6, 2012 8:23 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi,

I am trying to index a vector so I can establish the location of a given number. So for example, if x = 5 10 15 20 25 I can search for 20 and be given teh answer that 20 is the 4th number in the vector.

In a previous code I acheieved this with the line of code:

[c index] = min(abs(g-h));

However if I try:

[c index] = x

It does not work. Please can someone offer some help as to how I can search along a vector for a specific value and identify the location of the value?

Thank you
Dan



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.