comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » what is the highest subscript in the array?!?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: what is the highest subscript in the array?!? [message #70849 is a reply to message #70774] Fri, 07 May 2010 12:05 Go to previous messageGo to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On May 7, 3:46 pm, munka <mynameismu...@gmail.com> wrote:
>> On May 7, 6:20 am, wlandsman <wlands...@gmail.com> wrote:
>> Sorry, that should be
>
>>  dum = max(flux[1:N_elements(flux)-2], c) & index = c+1
>
> That still does not return the LOCAL maximum.  If the max is on the
> edge, it will still return a value
>
> IDL> flux=findgen(10)
> IDL> print,flux
>       0.00000      1.00000      2.00000      3.00000      4.00000
> 5.00000
>       6.00000      7.00000      8.00000      9.00000
> IDL> print,max(flux)
>       9.00000
> IDL> print,max(flux[1:N_elements(flux)-2], c)
>       8.00000
> IDL> print,c+1
>            8

Could do something like

nflux=n_elements(flux)
local_maxima=where((flux[1:nflux-2] ge flux[2:nflux-1]) and
(flux[1:nflux-2] ge flux[0:nflux-3]))+1

That would give the indexes of all points that are local maxima,
defined as those larger than or equal to their immediate neighbors.
Then max() or histogram() may be used to pick the highest maxima,
depending on what is wanted.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Plotting 3D array as a 'cloud'
Next Topic: Re: Begin-End matching in IDLDE?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:32:02 PDT 2025

Total time taken to generate the page: 0.00425 seconds