Re: Expanding Arrays of Structures [message #50349] |
Thu, 28 September 2006 08:50  |
Foldy Lajos
Messages: 268 Registered: October 2001
|
Senior Member |
|
|
On Thu, 28 Sep 2006, Haje Korth wrote:
> Hi,
> It's one of those days. You think you know IDL but you really don't.
> Well, may be someone can help.
>
> I have an array of structures created like
> s1={a:0,b:0,c:0}
> s2=replicate(s1,10)
>
> Is there a way to expand this array by another tag "d" so that
> essentially every array index contains the structure {a,b,c,d}?
>
> The reason why I don't include "d" right away is thatI read the
> structure content from files, where the additional variable is not
> available.
>
> I have looked at struct_assign and create_struct, but I don't think
> they can do what I want.
>
> Does anyone have any idea except copying every freakin' tag
> separately???
>
> Thanks,
> Haje
>
Hi,
struct_assign will do the job:
s1={a:1,b:2,c:3}
s2=replicate(s1,10)
s1ext={a:1,b:2,c:3,d:4} ; you can build s1ext with create_struct
s2ext=replicate(s1ext, 10)
struct_assign, s2, s2ext
regards,
lajos
|
|
|
Re: Expanding Arrays of Structures [message #50478 is a reply to message #50349] |
Fri, 29 September 2006 05:24  |
Haje Korth
Messages: 651 Registered: May 1997
|
Senior Member |
|
|
Thanks, great, I was barking up the wrong tree. I tried to append the
original structure by the new tag, which did not work. It did not
occurr to me that the solution is to regenerate the entire structure
including the new tags.
Haje
PS: Sorry for the double post... It's Googles fault... :-)
FĂ–LDY Lajos wrote:
> On Thu, 28 Sep 2006, Haje Korth wrote:
>
>> Hi,
>> It's one of those days. You think you know IDL but you really don't.
>> Well, may be someone can help.
>>
>> I have an array of structures created like
>> s1={a:0,b:0,c:0}
>> s2=replicate(s1,10)
>>
>> Is there a way to expand this array by another tag "d" so that
>> essentially every array index contains the structure {a,b,c,d}?
>>
>> The reason why I don't include "d" right away is thatI read the
>> structure content from files, where the additional variable is not
>> available.
>>
>> I have looked at struct_assign and create_struct, but I don't think
>> they can do what I want.
>>
>> Does anyone have any idea except copying every freakin' tag
>> separately???
>>
>> Thanks,
>> Haje
>>
>
> Hi,
>
> struct_assign will do the job:
>
> s1={a:1,b:2,c:3}
> s2=replicate(s1,10)
>
> s1ext={a:1,b:2,c:3,d:4} ; you can build s1ext with create_struct
> s2ext=replicate(s1ext, 10)
>
> struct_assign, s2, s2ext
>
>
> regards,
> lajos
|
|
|