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

Home » Public Forums » archive » Re: Create new arrays from series of subsequent integers in an existing 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: Create new arrays from series of subsequent integers in an existing array [message #48812 is a reply to message #48797] Tue, 23 May 2006 15:55 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jonathan Wolfe writes:

> Thank you both for your help! In regards to JD's saving the output
> arrays with pointers... I have never used pointers and believe this is
> a case in which they are necessary.
>
> After writing a long, drawn out explanation of where I was stuck with
> pointers I ended up figuring them out. Just in case anyone new to
> pointers wants to know how to get variables from an example such as the
> above threads, use something like this:
>
> x= ptrarr(3)
>
> for i = 1L, n_elements(h) - 1L do begin
> t=ri[ri[i]:ri[i+1]-1]
> x[i] = PTR_NEW( t,/allocate_heap )
> endfor
>
> print,*x(2)
>
> and you will have your varying size arrays of a larger array segmented
> into different subscripts of x.
>
> I'm sure there may be a better way to do this, but it makes sense to me.

I wrote up a slightly different method on my web page:

http://www.dfanning.com/idl_way/avgseries.html

Be sure you free up your pointers when you are finished with them:

Ptr_Free, x

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: SAVE files with /ROUTINES for Previous Versions
Next Topic: PLOTHIST and tick marks

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

Current Time: Fri Oct 10 19:14:22 PDT 2025

Total time taken to generate the page: 0.24166 seconds