LIST to STRUCTURE [message #93182] |
Mon, 09 May 2016 14:51  |
Jordan Guerra
Messages: 5 Registered: August 2012
|
Junior Member |
|
|
Hi All,
I have a list that a read in from a data base in the form:
IDL> help, data_str, /str
DATA_STR LIST <ID=6 NELEMENTS=12741>
Each element in this list is an structure itself, for example:
IDL> help, data_str[0], /str
** Structure <1cb83208>, 7 tags, length=112, data length=112, refs=2:
DATA STRUCT -> <Anonymous> Array[1]
FC_ID STRING 'id_string'
LAT_HG DOUBLE 12.086699
LONG_CARR DOUBLE -16.656586
LONG_HG DOUBLE 16.840149
NAR LONG64 804
TIME_START STRING '2013-01-01T00:59:52Z'
Is there a way to transform the list to an IDL structure?
Thanks.
|
|
|
Re: LIST to STRUCTURE [message #93183 is a reply to message #93182] |
Mon, 09 May 2016 17:32  |
Heinz Stege
Messages: 189 Registered: January 2003
|
Senior Member |
|
|
Hi Jordan,
here is some code which may need adding error-checking:
result=!null
for i=0,n_elements(data_str)-1 do $
result=create_struct(result,tag_names(data_str[i],/structure ),data_str[i])
Cheers, Heinz
|
|
|