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

Home » Public Forums » archive » Re: IDL Array Push
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: IDL Array Push [message #70323] Tue, 06 April 2010 03:52 Go to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Apr 5, 1:36 pm, Aram Panasenco <panasencoa...@gmail.com> wrote:
> On Apr 5, 9:23 am, James <donje...@gmail.com> wrote:
>
>> How is this different from concatenating two arrays like [[[array1]],
>> [[array2]]]?
>
> *facedesk*
>
> It's not. I completely forgot about concatenating arrays. Oh well, I
> suppose it was good coding practice anyway.

In my version of PUSH, it concatenates the two arrays if they exist,
but creates the first one with the contents of the second if it
doesn't. That makes it easy to stick into a loop where you don't know
whether the original array will exist at entry (or if you explicitly
know that it won't).

-Jeremy.
Re: IDL Array Push [message #70333 is a reply to message #70323] Mon, 05 April 2010 10:36 Go to previous messageGo to next message
Aram Panasenco is currently offline  Aram Panasenco
Messages: 41
Registered: April 2010
Member
On Apr 5, 9:23 am, James <donje...@gmail.com> wrote:
> How is this different from concatenating two arrays like [[[array1]],
> [[array2]]]?

*facedesk*

It's not. I completely forgot about concatenating arrays. Oh well, I
suppose it was good coding practice anyway.
Re: IDL Array Push [message #70334 is a reply to message #70333] Mon, 05 April 2010 09:23 Go to previous messageGo to next message
James[2] is currently offline  James[2]
Messages: 44
Registered: November 2009
Member
How is this different from concatenating two arrays like [[[array1]],
[[array2]]]?
Re: IDL Array Push [message #70336 is a reply to message #70334] Sun, 04 April 2010 21:41 Go to previous messageGo to next message
Aram Panasenco is currently offline  Aram Panasenco
Messages: 41
Registered: April 2010
Member
Edit: Added a ROW keyword:
http://idl.pastebin.com/8cZfEBc1
Re: IDL Array Push [message #70417 is a reply to message #70323] Tue, 06 April 2010 11:23 Go to previous message
Aram Panasenco is currently offline  Aram Panasenco
Messages: 41
Registered: April 2010
Member
On Apr 6, 3:52 am, Jeremy Bailin <astroco...@gmail.com> wrote:
> On Apr 5, 1:36 pm, Aram Panasenco <panasencoa...@gmail.com> wrote:
>
>> On Apr 5, 9:23 am, James <donje...@gmail.com> wrote:
>
>>> How is this different from concatenating two arrays like [[[array1]],
>>> [[array2]]]?
>
>> *facedesk*
>
>> It's not. I completely forgot about concatenating arrays. Oh well, I
>> suppose it was good coding practice anyway.
>
> In my version of PUSH, it concatenates the two arrays if they exist,
> but creates the first one with the contents of the second if it
> doesn't. That makes it easy to stick into a loop where you don't know
> whether the original array will exist at entry (or if you explicitly
> know that it won't).
>
> -Jeremy.

Wow, that's a great idea! It makes my code looks so much cleaner.
Compare:

polyPts = vertices[0:1,0]
polyPts = [[polyPts],[cartPts1]]
polyPts = [[polyPts],[vertices[0:1,1]]]

and

push, polyPts, vertices[0:1,0]
push, polyPts, cartPts1
push, polyPts, vertices[0:1,1]

Here's the new code: http://idl.pastebin.com/B0gm95pW

~Aram Panasenco
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Using IDL Help on Mac OS clients
Next Topic: Best way to generate arrays of coordinates for hypersurface calculations?

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

Current Time: Wed Oct 08 11:42:42 PDT 2025

Total time taken to generate the page: 0.00551 seconds