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

Home » Public Forums » archive » How can I append a leading or trailing column to an existing array?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
How can I append a leading or trailing column to an existing array? [message #51353] Thu, 16 November 2006 13:22
willettk is currently offline  willettk
Messages: 20
Registered: October 2006
Junior Member
G'day,

I'm looking for a quick (ie, one-line method) of appending a column
vector to an existing array. As a simple example I would like to make:

1 1
1 1

into

2 1 1
2 1 1

I can think of a few ways to do it (one is listed below), but I would
really like to do it using array concatenation. I've read a good
tutorial about it at Coyote's website, but can't figure out the proper
bracketing. Any ideas?

My way:

a = [ [1,1], [1,1] ]
b = [2,2]
c = intarr[3,2]
c(0,*) = b
c(1:2,*) = a

(there must be a better way . . . )

-thanks,
kwill
[Message index]
 
Read Message
Previous Topic: Re: Generating errors
Next Topic: Re: How can I append a leading or trailing column to an existing array?

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

Current Time: Wed Oct 08 16:09:19 PDT 2025

Total time taken to generate the page: 0.00185 seconds