On Apr 16, 1:27=A0pm, Bruce Bowler <bbow...@[EMAIL PROTECTED]
> wrote:
> On Wed, 16 Apr 2008 12:07:29 -0700, Conor wrote:
> > I'd like to see someone explain this one. =A0My stddev function
apparent=
ly
> > lost all grasp on reality?
>
> > IDL> print,stddev([1,2,3,4,5])
> > =A0 =A0 =A0 3.07421 =A0 =A0 =A03.24566 =A0 =A0 =A03.08206 =A0 =A0
=A03.2=
6360 =A0 =A0 =A02.97446
> > IDL> print,stddev([1.,2.,3.,4.,5.])
> > =A0 =A0 =A0 3.07421 =A0 =A0 =A03.24566 =A0 =A0 =A03.08206 =A0 =A0
=A03.2=
6360 =A0 =A0 =A02.97446
> > IDL> print,stddev([1.,2.])
> > =A0 =A0 =A0 3.07421 =A0 =A0 =A03.24566
>
> Did you perhaps have an array named stddev?
That would cause the behavior you are seeing: IDL can't tell the
difference between indexing the stddev array or calling the stddev
function. The fix is to use
compile_opt strictarr
at the beginning of every routine you write (which will force you to
never use parentheses for indexing arrays). You can also put it in a
startup file to eliminate mixups on the command line (probably more
common).
Mike
--
www.michaelgalloy.com
Tech-X Cor****ation
Software Developer II


|