Wednesday, February 26, 2014

IDL data structure

a) A named structure
is created by executing a structure-definition expression, which is an expression of the following form:

{Structure_Name,
  Tag_Name1 : Tag_Definition1,
   ...,
  Tag_Namen : Tag_Definitionn}

b) Anonymous structures
 are created in the same way, but with the structure’s name omitted.

{Tag_Name1 : Tag_Definition1 ,
     ...,
    Tag_Namen : Tag_Definitionn}

c)  Example
1) A named data structure example:
A = {star,           $           ; star is the structure name. 
     name  : '',     $           ; A is a variable of type star.       
     ra    : 0.0,    $ 
     dec   : 0.0,    $
     inten : FLTARR(12)}
 
2) Anonymous data structure example: 
way 1: 
A = {                $  
     name  : '',     $
     ra    : 0.0,    $ 
     dec   : 0.0,    $
     inten : FLTARR(12)}

 way 2: 
A = CREATE_STRUCT('name',    '',      $
                                          'ra',        0.0,   $
                                          'dec',     0.0,   $   
                                           'inten'FLTARR(12)) 
 

No comments:

Post a Comment