Is there any way to change the dimension of a field in a structure? [message #58155] |
Mon, 21 January 2008 22:11 |
Hongkai
Messages: 6 Registered: September 2006
|
Junior Member |
|
|
Hi folks,
I've been trying to change the dimension of a field in a
structure, like the followings:
S = {Dog:lindgen(3,112), Cat:'cc', Horse:[1,2,4]}
S.Dog = lindgen(3,118)
I got this:
'Conflicting data structures: structure tag,<LONG Array[3,118]>.'
This is reasonable because IDL dose not allow to change the dimensions
of the fields in the structure.
I can solve this problem by redefining another structure S1 with the
same tag names of S:
S1 = {Dog:lindgen(3,118), Cat:'cc', Horse:[1,2,4]}
S = S1
However, the question is, if I only know the tag name of the field
Dog, and I don't know the tag names of other fields in S, how can I
change the dimension of Dog?
I've tried this:
aa = tag_names(S1)
S = {aa(0):lindgen(3,118), aa(1):S.(1),a a(2):S.(2)}
but this only got a syntax error !
Thanks!
Hongkai
|
|
|