Home Up Next

Subchapters:

The structures

You can handle a data base of, saying, stars, defining for each star for example a name, a right ascension, a declination and a magnitude.
To create such a structure, just do:

      IDL> aaa = {etoile, name: 'Star1', ra: 10.0, dec: 20.5, mag : 10.6}

Where etoile is the name of this newly defined structure followed by the different tags and initial values for each. You can have a look on aaa:

      IDL> help,aaa
            AAA               STRUCT    = -> ETOILE Array[1]

If you want to know more about the structure, add the keyword /str to the help command:

      IDL> help,aaa,/str
            ** Structure ETOILE, 4 tags, length=20:
               NAME            STRING    'Star1'
               RA              FLOAT           10.0000
               DEC             FLOAT           20.5000
               MAG             FLOAT           10.6000

You can access one or all the tags of the structure etoile by:

      IDL> print, aaa.ra
                  10.0000
      IDL> print,aaa
             {Star1      10.0000      20.5000      10.6000}
      IDL> aaa.ra = 12.67
      IDL> print,aaa
            { Star1      12.6700      20.5000      10.6000}

 

IDL courses C. Morisset 2004 IA/UNAM V 2.2

Home Up Next