0

I was wondering if someone knew how to add more values to a structure variable in IDL?

For example, if we have the structure 'struct'

struct = {structname, x:[1,2,3], y:[10,11,12]}

And I specifically wanted to add [4,5,6] to x, something like:

struct.x.add([4,5,6])

How would I do this?

mgalloy
  • 2,356
  • 1
  • 12
  • 10
Sky S
  • 1

1 Answers1

0

If you made x a list instead of an array, you could do this easily:

struct = {structname, x:list([1, 2, 3], /extract), y:[10, 11, 12]}
struct.x->add, [4, 5, 6], /extract

It is more difficult, and less efficient, to use arrays for lists of things that change length. You definitely can't do it with named structures because the only way to do it is to change the definition of the structure, which you can do only if you replace one anonymous structure with another.

mgalloy
  • 2,356
  • 1
  • 12
  • 10