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 3:30 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

dpb <> wrote in message <lmt2h2$qso$>...
> On 6/6/2014 1:11 PM, Bruno Luong wrote:

> What's misleading? I pointed out it was an alternative; he didn't
> specify precisely what solution he wished...

But he did: he wrote "The position would be after element 6 and before element 23.54."

> you didn't give any
> explanation of your solution, either or how it differs from FIND.

My solution is the same as FIND(..., 'first'), there might be a confusion about < and <=, but I guess OP can read the DOC to figure out the detail.

However INTERP1 is the only proposed solution that does not accomplish what OP has specified, since gives a position before (6+23.54)/2. Therefore it is misleading.

> Whatever...again OP didn't say anything about array size(s) from which
> to judge whether speed would be an issue or not...

I claim it's a poor choice using ARRAYFUN in general. Just a litle bit like EVAL is a poor choice in general (OK, may be not that problematic), but IMO new users should learn NOT to abuse the usage of ARRAYFUN.


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.