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

Home » Public Forums » archive » Structure Arrays
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
Structure Arrays [message #50350] Thu, 28 September 2006 08:44 Go to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
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
Re: Structure Arrays [message #50477 is a reply to message #50350] Fri, 29 September 2006 05:28 Go to previous message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Thanks, Greg, it does indeed work. As noted in my double post (sorry) I
tried to simply append the structure, which did not succeed. I am not
memory constrained, so your solution will work. Haje


greg michael wrote:
> I think struct_assign does it...
>
> IDL> t1={a:0,b:0,c:0,d:4}
> IDL> t2=replicate(t1,10)
> IDL> print,t2
> { 0 0 0 4}{ 0 0 0 4}{
> 0 0 0 4}{ 0 0 0 4}{
> 0 0 0 4}{ 0 0 0 4}{ 0
> 0 0
> 4}{ 0 0 0 4}{ 0 0 0
> 4}{ 0 0 0 4}
> IDL> s1={a:1,b:2,c:3}
> IDL> s2=replicate(s1,10)
> IDL> print,s2
> { 1 2 3}{ 1 2 3}{ 1 2
> 3}{ 1 2 3}{ 1 2 3}{ 1
> 2 3}{ 1 2 3}{ 1 2 3}{
> 1 2 3
> }{ 1 2 3}
> IDL> struct_assign,s2,t2,/nozero
> IDL> print,t2
> { 1 2 3 4}{ 1 2 3 4}{
> 1 2 3 4}{ 1 2 3 4}{
> 1 2 3 4}{ 1 2 3 4}{ 1
> 2 3
> 4}{ 1 2 3 4}{ 1 2 3
> 4}{ 1 2 3 4}
>
> regards,
> Greg
Re: Structure Arrays [message #50479 is a reply to message #50350] Fri, 29 September 2006 04:45 Go to previous message
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
I think struct_assign does it...

IDL> t1={a:0,b:0,c:0,d:4}
IDL> t2=replicate(t1,10)
IDL> print,t2
{ 0 0 0 4}{ 0 0 0 4}{
0 0 0 4}{ 0 0 0 4}{
0 0 0 4}{ 0 0 0 4}{ 0
0 0
4}{ 0 0 0 4}{ 0 0 0
4}{ 0 0 0 4}
IDL> s1={a:1,b:2,c:3}
IDL> s2=replicate(s1,10)
IDL> print,s2
{ 1 2 3}{ 1 2 3}{ 1 2
3}{ 1 2 3}{ 1 2 3}{ 1
2 3}{ 1 2 3}{ 1 2 3}{
1 2 3
}{ 1 2 3}
IDL> struct_assign,s2,t2,/nozero
IDL> print,t2
{ 1 2 3 4}{ 1 2 3 4}{
1 2 3 4}{ 1 2 3 4}{
1 2 3 4}{ 1 2 3 4}{ 1
2 3
4}{ 1 2 3 4}{ 1 2 3
4}{ 1 2 3 4}

regards,
Greg
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Expanding Arrays of Structures
Next Topic: IDLWAVE and call-external

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

Current Time: Wed Oct 08 19:47:07 PDT 2025

Total time taken to generate the page: 0.00499 seconds