construction of array


dn123
07-07-2010, 03:12 AM
hello all...
i am new in fortran programming.i have a problem..
i have some no. like 12,34,67,45,89, etc..i want to construct an array...of these no...,but how..?
please help..
regards

davekw7x
07-07-2010, 09:23 AM
new in fortran programmingThen I respectfully suggest that you get a textbook or find an on-line tutorial that covers fundamentals of the language before you actually start trying to create programs.

... 12,34,67,45,89, etc..i want to construct an array......

PROGRAM test_int_array

IMPLICIT NONE

INTEGER i
INTEGER, PARAMETER :: NumberOfNums = 5
INTEGER, DIMENSION(NumberOfNums) :: nums

nums = (/12, 34, 67, 45, 89/)

DO i = 1, NumberOfNums
WRITE(*, '("nums(", I0, ") = ", I0)') i, nums(i)
END DO

END PROGRAM test_int_array

Output:

nums(1) = 12
nums(2) = 34
nums(3) = 67
nums(4) = 45
nums(5) = 89


Regards,

Dave

dn123
07-13-2010, 01:50 AM
thanks dave.
actually my problem is...i have binary data of 278 by 278 dimension,with pixel size of 4 km, every pixel has its lat lon.
i have data of every 10 minutes.,wat i want to do..is first read the first file, and store it in an array,...like.x(i,j)=lat,y(i,j)=lon,
and z(i,j)=rain,..
now when i read d second file,...i can able to compare..that..in a particular no of pixel. like (1,5).,,,if d rain is a then for the second file wat it is. i have to autocorrelate d rain...

regards
dn123