[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*Subject*: Re: forcing variable definition in IDL?*From*: "Liam E. Gumley" <Liam.Gumley(at)ssec.wisc.edu>*Date*: Tue, 01 May 2001 13:19:53 -0500*Newsgroups*: comp.lang.idl-pvwave*Organization*: Space Science and Engineering Center, UW-Madison*References*: <3AEE557E.126C92E8@kurasc.kyoto-u.ac.jp> <MPG.15585ab742faff65989dfa@news.frii.com> <m3n18xkmjd.fsf@odysseus.localdomain>*Xref*: news.doit.wisc.edu comp.lang.idl-pvwave:24763

William Daffer wrote: > > davidf@dfanning.com (David Fanning) writes: > [...] > > > Don't bother. IDL scalars *are* single element arrays: > > > > IDL> a=5 > > IDL> a[0] = 6 & Print, a > > > > Um... Not true. > > IDL> a=['foo|bar'] > IDL> print,strsplit(a,'|',/extract) > % STRTOK: Expression must be a scalar in this context: STRING. > % Execution halted at: STRSPLIT 24 > /usr/local/rsi/idl_5.3/lib/strsplit.pro > % $MAIN$ > IDL> retall > IDL> print,strsplit(a[0],'|',/extract) > foo bar > IDL> > > There are some other RSI supplied code where one sees this behavior. > > By the way, this is idl 5.3. I haven't checked idl 5.4. An array with one element is an *array*, i.e., it has one dimension: IDL> a = [25] IDL> help, a A INT = Array[1] IDL> print, size(a, /n_dimensions) 1 A single subscripted array element is a *scalar expression*, i.e., it has no dimensions: IDL> a = [1, 2, 3, 4, 5] IDL> help, a[0] <Expression> INT = 1 IDL> print, size(a[0], /n_dimensions) 0 A scalar may be treated as though it were a single subscripted array element. However, as shown above, a scalar expression has no dimensions: IDL> a = 100 IDL> help, a A INT = 100 IDL> help, a[0] <Expression> INT = 100 IDL> print, size(a, /n_dimensions) 0 IDL> print, size(a[0], /n_dimensions) 0 The implementer of STRTOK (which is called by STRSPLIT) is therefore checking for an input argument which has no dimensions. Cheers, Liam. http://cimss.ssec.wisc.edu/~gumley/

**Follow-Ups**:**Re: forcing variable definition in IDL?***From:*William Daffer

**References**:**forcing variable definition in IDL?***From:*Gernot Hassenpflug

**Re: forcing variable definition in IDL?***From:*David Fanning

**Re: forcing variable definition in IDL?***From:*William Daffer

- Prev by Date:
**Dereferencing a Pointer Array** - Next by Date:
**Re: Dereferencing a Pointer Array** - Prev by thread:
**Re: forcing variable definition in IDL?** - Next by thread:
**Re: forcing variable definition in IDL?** - Index(es):