IDL Passing Constants to a Procedure
Posted on 2006-06-05
This has boggled my mind for quite some time. I have a short procedure that takes in four integers and performs some simple calculations with them. We'll call this procedure "buildProfile".
I have another procedure (generateSlice) that generates four numbers, with the objective of and passing them to buildProfile.
That procedure looks like this:
Pro generateSlice, x1, x2, y1, y2
firstPoint = fix(randomu(seed, 1) * 800)
secondPoint = fix(randomu(seed, 1) * 800)
x1 = 0 ;Constants
x2 = 799 ;Constants
y1 = firstPoint
y2 = secondPoint
So, if I call generateSlice, a, b, c, d, I get the numbers 0, 799, and two random integers between 0 and 799, assigned to the variables a, b, c, d respectively.
However, if I then call buildProfile, a, b, c, d, the procedure does not produce the expected result. However, if I were to call buildProfile, x1, x2, 580, 700 (replacing the last two variables with constant values of my own), it works perfectly fine. Is there any reason that assigning one variable to the value of another variable might cause problems in this context?