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

Home » Public Forums » archive » Re: Weird MIN behavior
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Weird MIN behavior [message #42745 is a reply to message #42743] Sun, 20 February 2005 14:42 Go to previous messageGo to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
Michael Wallace wrote:
> Can someone explain this?
>
>
> Normal case; everything works as you expect.
>
> IDL> a = [1.0, 2.0, 3.0, 4.0, 5.0]
> IDL> b = min(a, MAX = c)
> IDL> print, b, c
> 1.00000 5.00000
>
>
> Abnormal case; why doesn't this work?
>
> IDL> a = [1.0, 2.0, 3.0, 4.0, 5.0]
> IDL> r = dblarr(2)
> IDL> r[0] = min(a, MAX = r[1])
> % MIN: Expression must be named variable in this context: <DOUBLE ((
> 0.00000, 0.00000))>.

It's complaining about the argument passed to the MAX keyword. As it
says, this must be a named variable, and a subscripted variable does not
qualify because it is passed by value. You're lucky that IDL tells you
that it doesn't accept a subscripted variable here--in other situations
it quitely leaves the value unmodified and let's you puzzle it out later.

See IDL documentation on "Parameter Passing Mechanism". Also David
Fanning's site has relevant material, eg see the info about the correct
use of the ARG_PRESENT function in

http://www.dfanning.com/tips/keyword_check.html

and also

http://www.dfanning.com/tips/read_subscripted_array.html


--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: widget_base alignment question
Next Topic: Maximze a minimize GUI

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

Current Time: Sat Oct 11 08:57:59 PDT 2025

Total time taken to generate the page: 1.43858 seconds