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

Home » Public Forums » archive » Re: How to average every nth data?
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: How to average every nth data? [message #73395 is a reply to message #73392] Thu, 04 November 2010 12:24 Go to previous messageGo to previous message
Juggernaut is currently offline  Juggernaut
Messages: 83
Registered: June 2008
Member
On Nov 4, 1:53 pm, go cats <beardown...@gmail.com> wrote:
> Dear Gurus,
>
> Hope someone will help me how to figure this out.
> I've been keep trying to do some spectral resampling (just simple
> average) with ASD data.
> ASD data is a two dimensional array;
>
> wavelength    data
> 350             0.001146
> 351             0.001176
> 352             0.001147
>   .                      .
>   .                      .
>   .                      .
> 2500           0.0004311
>
> What I've been trying to do is averaging every nth data values and
> rewrite into a new array.
> For example, if I want to average every 3rd data values, the resulting
> array will be
>
> 350            0.001150
> 353            0.001147
> and so on.
>
> MS excel seems to be able to handle it, but it wouldn't be a good idea
> for processing several hundres files.
>
> I really appreciate if someone could give me tip(s).
>
> Thanks,
> Kim

You can also do something like this.
x = indgen(50)
mean_1 = mean(x)
mean_2 = mean(x[0:*:2])
mean_3 = mean(x[0:*:3])

The third element in your indexing indicates a skipping parameter.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SPAWN and strings
Next Topic: Re: SPAWN and strings

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

Current Time: Sat Oct 11 22:46:45 PDT 2025

Total time taken to generate the page: 0.71509 seconds