You are doing this correctly. The FLOAT() function does indeed convert the data type to float. I think that perhaps if this is in an IF statement, as you mention, it may not be executing if the criterion in the IF statement is not met.
To test the FLOAT() function try something like that below. As you can see, the data type before and after the FLOAT() function is used has changed:
IDL> x = indgen(3,3)
IDL> help, x
X INT = Array[3, 3]
IDL> print, x
0 1 2
3 4 5
6 7 8
IDL> newx = float(x)
IDL> help, newx
NEWX FLOAT = Array[3, 3]
IDL> print, newx
0.000000 1.00000 2.00000
3.00000 4.00000 5.00000
6.00000 7.00000 8.00000
What I think might be going on, again, is that the criterion in the IF statement is not being met. For example, something like this would not convert to float:
IDL> x = indgen(3,3)
IDL> help, x
X INT = Array[3, 3]
IDL> criterion = 0
IDL> if criterion eq 1 then newx = float(x)
IDL> help, newx
NEWX UNDEFINED =
Use the HELP statement in your code to debug the issue, to determine what the data type has become, or if it has changed. You may need to place a HELP statement in several places in your code to determine what might be happening.
-JE
ITT VIS
Tech Support : support@ittvis.com
|