Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Idl-pvware > Re: array conca...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 9 Topic 5605 of 6261
Post > Topic >>

Re: array concatenation in 2-D

by Jean H <jghasban@[EMAIL PROTECTED] > Apr 9, 2008 at 09:44 AM

elwood wrote:
> On Apr 4, 2:31 pm, Jean H <jghas...@[EMAIL PROTECTED]
>
> wrote:
>> elwood wrote:
>>> I have a loop which calculates two variables x[i] and y[i]
>>> At each iteration of the loop I calculate
>>> x and y
>>> And I'd like to concatenate x and y into a 2 column, unknown numbers
>>> of rows
>>> output array.

> Alas, this is a form of concatenation, but it does not produce
> the required results.
> I need to concatenate by COLUMN, not row.
> If I code the concatenation you show, it produces:
> column 1:
> 1 2
> 3 4
> 5 6
> 
> Whereas I need it to paste the columns together such that I
> get
> 1  3  5
> 2  4  6
> 
> To be specific, each iteration of the loop
> I calculate new values of x and y
> I want to do the following, but using concatenation
> outputarry[0,0]=x1
> outputarry[1,0]=y1
> 
> next iteration
> outputarry[0,1]=x2
> outputarry[1,1]=y2
> 
> to get a final array where x values are in column 0
> y values are in column 1

your initial and second post are opposite! ... be sure to understand the 
row/column system used in IDL (see 
http://idlastro.gsfc.nasa.gov/idl_html_help/Columns_Rows_and_Array_Majority.html

)

Anyways, you can do concatenation, according to your 2nd post like that:
a = [[1,3],[2,4]]
a= [a,transpose([5,6])]
IDL> print,a
        1       3       5
        2       4       6

  Jean
 




 9 Posts in Topic:
array concatenation in 2-D
elwood <epolomsk@[EMAI  2008-04-04 11:38:54 
Re: array concatenation in 2-D
David Fanning <news@[E  2008-04-04 12:57:21 
Re: array concatenation in 2-D
"R.G. Stockwell"  2008-04-04 13:27:03 
Re: array concatenation in 2-D
David Fanning <news@[E  2008-04-04 13:40:09 
Re: array concatenation in 2-D
Jean H <jghasban@[EMAI  2008-04-04 13:31:13 
Re: array concatenation in 2-D
"ben.bighair" &  2008-04-04 14:25:35 
Re: array concatenation in 2-D
elwood <epolomsk@[EMAI  2008-04-08 18:19:27 
Re: array concatenation in 2-D
Jean H <jghasban@[EMAI  2008-04-09 09:44:29 
Re: array concatenation in 2-D
Spon <christoph.blau@[  2008-04-08 23:37:12 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 21:04:36 CDT 2008.