Re: concatenate by columns [message #72120] |
Fri, 06 August 2010 15:15 |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Aug 6, 7:02 pm, Astro Fest <astrofes...@gmail.com> wrote:
> Is there a better way to concatenate by columns than converting to
> rows, concatenating, and converting back? This is the way I'm doing
> it now, which seems really clunky.
>
> For example, say I have:
> IDL> a = indgen(2,10) & b = indgen(2,6)
> which are placeholders for arrays given by array_indices. I want to
> get c as a (2,16) array... and currently I'm doing
> IDL> c = transpose([[transpose(a)],[transpose(b)]])
c=[[a],[b]]
|
|
|
Re: concatenate by columns [message #72121 is a reply to message #72120] |
Fri, 06 August 2010 15:11  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Astro Fest writes:
> Is there a better way to concatenate by columns than converting to
> rows, concatenating, and converting back? This is the way I'm doing
> it now, which seems really clunky.
>
> For example, say I have:
> IDL> a = indgen(2,10) & b = indgen(2,6)
> which are placeholders for arrays given by array_indices. I want to
> get c as a (2,16) array... and currently I'm doing
> IDL> c = transpose([[transpose(a)],[transpose(b)]])
Yes.
IDL> a = indgen(2,10) & b = indgen(2,6)
IDL> c = [[a],[b]]
IDL> help, c
C INT = Array[2, 16]
http://www.dfanning.com/tips/array_concatenation.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|