Re: Structure reforming [message #31053 is a reply to message #31050] |
Tue, 04 June 2002 07:51   |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Ivan Valtchanov wrote:
>
> Hi all,
>
> I have an IDL structure variable like this:
>
> help, ccc
> CCC STRUCT = -> <Anonymous> Array[1]
>
> help, ccc, /struct
> NAME STRING Array[133]
> RA DOUBLE Array[133]
>
> and I would like to reform it like this
> help,ccc
> CCC STRUCT = -> <Anonymous> Array[133]
> help,ccc,/struct
> NAME STRING g01
> RA DOUBLE 316.022
>
> Is there any fast way to do it?
>
> Thanks a lot.
>
> Ivan
You can use my reform_struct.
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/reform_struct.tar.gz
regards
Reimar
; NAME:
; reform_struct
;
; PURPOSE:
; This function is used to reform a structure as tag array or struct
array
;
; CATEGORY:
; PROG_TOOLS/STRUCTURES
;
; CALLING SEQUENCE:
;
result=reform_struct(structure,dim1,[dim2],[dim3],[dim4],[di m5],[dim6],[dim7],[dim8],[/struct_array],[/tag_array]
;
; INPUTS:
; structure: a structures
; dim1: the new dimension of the input structure (1D to 8D)
;
; OPTIONAL INPUTS:
; dim2 to dim8: additional dimensions if not declared in dim1
;
; KEYWORD PARAMETERS:
; struct_array: if is set output structure is an array
; tag_array: if is set output structure is 1D and tags are arrays
; You have to set one of these keywords
;
; EXAMPLE:
; data=create_struct('A',FINDGEN(15),'B',SIN(FINDGEN(15)))
; result=reform_struct(data,15,/struct_array)
; HELP,result
; RESULT STRUCT = -> <Anonymous> Array[15]
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
============================================================ =======
|
|
|