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

Home » Public Forums » archive » Replicate array over columns - using transpose?
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
Replicate array over columns - using transpose? [message #79700] Thu, 22 March 2012 03:11
Robin Wilson is currently offline  Robin Wilson
Messages: 40
Registered: August 2010
Member
Hi all,

I've got an array, a, as follows:

IDL> print, a
10.0000 35.0000 60.0000 85.0000 110.000

I want to replicate this across 4 columns to produce an array like the
following:

10 10 10 10
35 35 35 35
60 60 60 60
85 85 85 85
110 110 110 110

I'm using the CMREPLICATE routine to do this, and get the following:

IDL> print, CMREPLICATE(a, 4)
10.0000 35.0000 60.0000 85.0000 110.000
10.0000 35.0000 60.0000 85.0000 110.000
10.0000 35.0000 60.0000 85.0000 110.000
10.0000 35.0000 60.0000 85.0000 110.000

However, I want to replicate it in the columns as in the example above.
As far as I can see it there are two ways to deal with this: transpose
the array after I've done it (computationally expensive, as I'll be
doing it with far larger arrays in the real program) or transpose it
before running CMREPLICATE. However, if I do this I get an extra
dimension added:

IDL> help, CMREPLICATE(transpose(a), 4)
<Expression> FLOAT = Array[1, 5, 4]

Is there a way to replicate over the columns without adding this extra
dimension? I'm sure I'm missing something simple here.

Cheers,

Robin
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Cursor problem when switching windows
Next Topic: Re: New color palette

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

Current Time: Wed Oct 08 13:35:39 PDT 2025

Total time taken to generate the page: 0.00442 seconds