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

Re: forcing variable definition in IDL?



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.

whd
-- 
Outside of a dog a book is man's best friend. 
Inside of a dog it's too dark to read
                             Groucho Marx