The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Finding position in array
Replies: 10   Last Post: Jun 6, 2014 6:42 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bruno Luong

Posts: 9,822
Registered: 7/26/08
Re: Finding position in array
Posted: Jun 6, 2014 1:03 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> Yet another approach somewhat akin to Bruno's...

> >> interp1(a,1:length(a),x,'nearest')
> ans =
> 3

Not completely equivalent, INTERP1 will has the resulting index jumps by 1 unit when passing the middle point of the EDGES, whereas HISTC jumps right at the EDGES.

INTERP1 and HISTC methods can deal with x as vector (not FIND()).

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.