Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
In article <4r48vn$jpu@lace.colorado.edu> kachun@bogart.Colorado.EDU (Ka Chun Yu) writes: > Does anyone know how to access parts of structures in IDL? Looking > up the version of IDL, I can type: > IDL> print,!version > { sparc sunos 3.6.1} > I can't directly access the individual components, since a help will > give: > IDL> help,!version > <Expression> STRUCT = -> !VERSION Array(1) For this, try HELP,/STRUCT,!version which gives something like: ** Structure !VERSION, 4 tags, length=32: ARCH STRING 'x86' OS STRING 'Win32' OS_FAMILY STRING 'Windows' RELEASE STRING '4.0.1' Also handy are the routines: N_TAGS(!version) which returns the number of tags in the structure TAG_NAMES(!version) which gives an array of strings containing the tag names Finally, tags can also be referenced by: !version.(0) which is the same as !version.arch !version.(1) !version.os etc. Hope this helps. Brian Jackel University of Western Ontario
In article <4r48vn$jpu@lace.colorado.edu>, kachun@bogart.Colorado.EDU (Ka Chun Yu) writes: > My question is then how would I pull out what I need to know from > !version if I didn't know the names for the individual components > (i.e., "!version.arch", "!version.os")? Is there a command that > can pull out what I need, like this example below? > > IDL> print,MYSTERY_COMMAND(!version,0) > sparc IDL> print,tag_names(!version) ARCH OS OS_FAMILY RELEASE Peter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ Peter "Pit" Suetterlin http://www.uni-sw.gwdg.de/~pit Universitaets-Sternwarte Goettingen Tel.: +49 551 39-5048 pit@uni-sw.gwdg.de -- * -- * ...-- * -- * ...-- * -- * ...-- * -- * ...-- * -- * ...-- * -- Come and see the stars! http://www.kis.uni-freiburg.de/~ps/SFB Sternfreunde Breisgau e.V. Tel.: +49 761 278588 ____________________________________________________________ ______________
kachun@bogart.Colorado.EDU (Ka Chun Yu) writes: > My question is then how would I pull out what I need to know from > !version if I didn't know the names for the individual components > (i.e., "!version.arch", "!version.os")? Is there a command that > can pull out what I need, like this example below? > IDL> print,MYSTERY_COMMAND(!version,0) > sparc IDL> help,/STRUCTURE, !version ** Structure !VERSION, 4 tags, length=32: ARCH STRING 'sparc' OS STRING 'sunos' OS_FAMILY STRING 'unix' RELEASE STRING '4.0.1' -Joel -- "...And I am unanimous in this" - Mrs. Slocumbe ------------------------------------------------------------ ---------- | Joel D Offenberg | offenbrg@fondue.gsfc.nasa.gov | | Hughes STX, NASA/GSFC/LASP | UIT Sci team & COBE Unix SysAdm |