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

Re: Clever Where() test

Paul Probert <probert@uwmfe.neep.wisc.edu> writes:

>IDL allows you to give a zero subscript to a scalar, 
>so you can say: 
>     i=WHERE(...) 
>     IF i(0) EQ -1 THEN BEGIN 
>      ... 
>One word of caution.  If you have a scalar element of a structure, 
>for some reason you can't do this: 
>     x={i:0,j:1} 
>     IF x.i(0) ...    ;bombs 
>But you can make it work with more parentheses: 
>     IF (x.i)(0) ...  ;works 
>       Paul Probert 
>       University of Wisconsin

So does x(0).i

Bill Thompson