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

Home » Public Forums » archive » Re: concatenate by columns
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: concatenate by columns [message #72120] Fri, 06 August 2010 15:15
penteado is currently offline  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 Go to previous message
David Fanning is currently offline  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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: concatenate by columns
Next Topic: select first n elements of array without loop

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

Current Time: Wed Oct 08 17:29:33 PDT 2025

Total time taken to generate the page: 0.00564 seconds