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

Home » Public Forums » archive » Re: How do I add an array to the end of an existing array?
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: How do I add an array to the end of an existing array? [message #55072] Sun, 29 July 2007 12:44
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
On Jul 28, 12:00 am, snudge42 <snudg...@gmail.com> wrote:
> I want to do something which I'm sure is very simple. I have an array
> such as:
>
> 0 0
> 0 0
> 0 0
>
> and want to add a similar array to get
>
> 0 0
> 0 0
> 0 0
> 0 0
> 0 0
> 0 0
>
Note that for array operations, making examples with all zeroes is
likely to result in more confusion than not. Here's a relevant trick
to what I think your question was:
a=[[1,2],[3,4],[5,6]]
; this is one move:
print,rebin(a,2,6)
> 1 2
> 1 2
> 3 4
> 3 4
> 5 6
; this is another
print,[[a],[a]]
> 1 2
> 3 4
> 5 6
> 1 2
> 3 4
> 5 6

Note that your example with all 0's, could be satisfied by either of
these very different transforms.

Good luck,

Edward H.
Re: How do I add an array to the end of an existing array? [message #55083 is a reply to message #55072] Sat, 28 July 2007 05:48 Go to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
This is a good easy one and an important trick (way of thinking) to
learn.

IDL> a=[[1,1],[2,2],[3,3]]
IDL> print, a
1 1
2 2
3 3
IDL> b=[[4,4],[5,5]]
IDL> print, b
4 4
5 5
IDL> c=[[a],[b]]
IDL> print, c
1 1
2 2
3 3
4 4
5 5


Is this want you wanted?

Cheers,

Brian


------------------------------------------------------------ ---------------------
Brian Larsen
Boston University
Center for Space Physics
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Derivative along one dimension of a data cube?
Next Topic: Runtime error woes

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

Current Time: Wed Oct 08 15:52:46 PDT 2025

Total time taken to generate the page: 0.00488 seconds