comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: accessing structures
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: accessing structures [message #6471] Mon, 01 July 1996 00:00
offenbrg is currently offline  offenbrg
Messages: 31
Registered: August 1993
Member
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 |
Re: accessing structures [message #6475 is a reply to message #6471] Sun, 30 June 1996 00:00 Go to previous message
brian.jackel is currently offline  brian.jackel
Messages: 23
Registered: May 1996
Junior Member
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
Re: accessing structures [message #6476 is a reply to message #6475] Sun, 30 June 1996 00:00 Go to previous message
pit is currently offline  pit
Messages: 92
Registered: January 1996
Member
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
____________________________________________________________ ______________
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: save/restore file format
Next Topic: Simple MODULO question.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 13:14:27 PDT 2025

Total time taken to generate the page: 1.12169 seconds