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

Home » Public Forums » archive » Re: help array subscripting
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: help array subscripting [message #49100] Mon, 26 June 2006 09:38 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Sat, 24 Jun 2006 11:21:48 -0700, pimpk24 wrote:

> Hello all,
>
> I am looking for a more efficent way to subscript various data arrays to a
> time/index array
>
> Say I have data arrays : [x], [y], [z],
>
> and I have time arrays : [1pm] , [2pm], [3pm] , [4pm] etc......
>
> Right now I am simply doing this by typing:
>
> x_1pm = x[1pm]
> x_2pm=x[2pm]
>
> y_1pm=y[1pm] etc............
>
> This is very long and tedious, so I imagine (hope) there must be a better
> way.

You can either use higher-dimensional arrays (if 1pm, 2pm, 3pm
etc. all have the same length), and index them all at once, like:

times=[ [1_pm], [2_pm], [3_pm] ]
xt=x[times]
yt=y[times]

or, if they are of different length, use an array of pointers, ala:

times=ptrarr(n_times)
times[0]=ptr_new(...) ;; fill in the times pointer array

for i=0,n_elements(times)-1 do begin
xt=x[*times[i]]
yt=y[*times[i]]
;; do something with xt, yt
endfor

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Help with Roi syntax!
Next Topic: Re: what IDL version should be installed on a 64-bit redhat linux, SGI (MIPS) machine ?

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

Current Time: Thu Oct 09 23:20:27 PDT 2025

Total time taken to generate the page: 0.32241 seconds