Re: Arrays merging [message #47493] |
Wed, 15 February 2006 09:15  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Benjamin Hornberger writes:
> Julio wrote:
>>
>> ARRAY1 STRING = Array[15, 4]
>> ARRAY2 STRING = Array[15, 6]
>>
>> I need to merge these two arrays into 1. I'm using:
>>
>
> Try
>
> Array3 = [[array1], [array2]]
>
> and have a look at http://www.dfanning.com/tips/array_concatenation.html.
I guess Julio better specify how he wants his array
concatenated. I just took him at his word. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Arrays merging [message #47494 is a reply to message #47493] |
Wed, 15 February 2006 09:11   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Julio wrote:
> Hello, I have an easy question. I have two arrays:
>
> help, array1
> help, array2
>
> ARRAY1 STRING = Array[15, 4]
> ARRAY2 STRING = Array[15, 6]
>
> I need to merge these two arrays into 1. I'm using:
>
> Array3 = [array1, array2]
>
> But it doesn't work, since the dimensions do not agree. How can I do to
> concatenate these two arrays? How can I fill with zero values the
> array1 to match it with array2??
Try array3 = [[array1],[array2]]
IDL> x1=strarr(15,4)
IDL> x2=strarr(15,6)
IDL> help, x1, x2
X1 STRING = Array[15, 4]
X2 STRING = Array[15, 6]
IDL> help, [[x1],[x2]]
<Expression> STRING = Array[15, 10]
paulv
--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
|
|
|
|
Re: Arrays merging [message #47496 is a reply to message #47495] |
Wed, 15 February 2006 09:09   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Julio writes:
> Hello, I have an easy question. I have two arrays:
>
> help, array1
> help, array2
>
> ARRAY1 STRING = Array[15, 4]
> ARRAY2 STRING = Array[15, 6]
>
> I need to merge these two arrays into 1. I'm using:
>
> Array3 = [array1, array2]
>
> But it doesn't work, since the dimensions do not agree. How can I do to
> concatenate these two arrays? How can I fill with zero values the
> array1 to match it with array2??
Array4 = StrArr(15,6)
array4[0,0] = array1
array3 = [array4, array2]
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
|