Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
R. Bauer writes: > in addition to the first question I did: > > FUNCTION where2,arr,b,count > return,arr > end > > If i define this function and i call it like > a=indgen(10) > print,where2(a gt 4) > > the result is 0 0 0 0 0 1 1 1 1 1 > > what is wrong? My news server has been screwy all weekend, so I didn't see the first question. But there is *nothing* wrong here. Do this: a = Indgen(10) Print, (a gt 4) You get the result exactly as you do above: 0 0 0 0 0 1 1 1 1 1 This is, in fact, *exactly* what you put into the WHERE2 function above as its argument (called "arr" inside the program). In this case, you passed the argument in by *value*. Perhaps you expected it to be passed in by reference. All expressions (which this is), subscripted variables, structure de-references, etc are passed by value. Only variables are passed by reference. This result is exactly what I would expect. Cheers! David ---------------------------------------------------------- David Fanning, Ph.D. Fanning Software Consulting Customizable IDL Programming Courses Phone: 970-221-0438 E-Mail: davidf@dfanning.com Coyote's Guide to IDL Programming: http://www.dfanning.com
Hi, How did I have to write a function which will allow input like a=where2(b gt 10)? -- R.Bauer Institut fuer Stratosphaerische Chemie (ICG-1) Forschungszentrum Juelich email: R.Bauer@fz-juelich.de