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

Home » Public Forums » archive » Avoiding a for cicle
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Avoiding a for cicle [message #19664] Thu, 06 April 2000 00:00 Go to previous message
Ricardo Fonseca is currently offline  Ricardo Fonseca
Messages: 13
Registered: February 2000
Junior Member
Hi

I'm looking for a more efficient way of implementing the following (i.e.
avoiding the for cycle) which is a routine for finding local maximuns

; Data is a 1D Array

s = Size(Data)

nx = s[1]

max_pos = [-1]

for i = 1, nx-1 do $
if ((Data[i] gt Data[i-1]) and (Data[i] gt Data[i+1])) then $
max_pos = [[max_pos],i]

; and then throw away the first element...

Any ideas? Thanks in advance, Ricardo
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Q: IDL and endianness issues
Next Topic: Dissect SAVE files, and more!

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

Current Time: Sat Oct 11 06:36:31 PDT 2025

Total time taken to generate the page: 1.67900 seconds