declare variables [message #45942] |
Tue, 18 October 2005 12:49 |
qian
Messages: 3 Registered: July 2005
|
Junior Member |
|
|
Hi,
I am using FORTRAN and IDL at the same time, so sometime I just assume
some FORTRAN rules when using IDL. I just find out that the variable
type can change within an IDL program, even you declare it to be some
specific type. For example:
data=dblarr(2)
data=[2.3, 3.4]
then now, 'data' is a single precision array.
if I type
data=[2,3]
then it is an integer array.., and data(0)/data(1) = 0 !
I know I should be more careful when programming, always using:
data=[2.3D,4.5D]
But if I read in data from other files, in which '1' actually means
'1.0', is it possible I can re-inforce the array to be certain type (or
let the variables to be certain type throughtout the whole program)? So
even if I type d=1, it is still a real number?
Many thanks,
Qian
|
|
|