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

Home » Public Forums » archive » Calculating difference between each element in array from previous
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: Calculating difference between each element in array from previous [message #83805 is a reply to message #83680] Fri, 29 March 2013 19:03 Go to previous message
dg86 is currently offline  dg86
Messages: 118
Registered: September 2012
Senior Member
On Friday, March 29, 2013 8:07:08 PM UTC-4, Phillip Bitzer wrote:
> For a start, I think I see where you are differencing adjacent elements of an array. This can be done without looping:
>
>
>
> diff = arr - SHIFT(arr, 1)
>
>
>
> Note SHIFT will wrap around values, so if that's not important you'll want to "mask" this values somehow.

How about

diff = arr - arr[1:*]

This addresses the wrap-around issue.
[Message index]
 
Read Message
Read Message
Previous Topic: Using where to create new variables of data
Next Topic: Re: Can one close only one of STDIN and STDOUT when using SPAWN with the UNIT keyword?

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

Current Time: Thu Oct 16 21:30:50 PDT 2025

Total time taken to generate the page: 0.17862 seconds