- #1
aLostProgramm
- 2
- 0
I feel somewhat embarassed to ask for help concerning this. I am a C/C++ programmer, but I am currently learning Fortran 90 on the fly and in a hurry. I am going to have to read in a 32x25600 dataset into a 1-d array (I know, not especially efficicent). I decided to start with a more simplistic 5x4 dataset into a 1-d array, and would build from there. However, the unique syntax of Frotran 90 is confusing me. Below is my source code:
program test
IMPLICIT NONE
INTEGER I,var
CHARACTER*10 output
INTEGER, PARAMETER :: N=20
INTEGER, DIMENSION(N) :: X
OPEN (1,FILE="fake.dat",STATUS="OLD")
DO I=1,N
READ(1,"(5I3)",end=10) X(I)
END DO
10 do I=1,N
print *, X(I)
end do
END PROGRAM test
This is my dataset. The data is separated with a space in each row.
21 23 40 41 78
53 10 79 25 36
42 28 17 30 99
11 22 33 44 55
And this is my output:
11
22
33
44
55
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
I promise that I am not a student trying to get homework help. I am currently sitting in my cubicle trying to resist the temptation of punching my monitor out of frustration. Thanks in advance for the help.
program test
IMPLICIT NONE
INTEGER I,var
CHARACTER*10 output
INTEGER, PARAMETER :: N=20
INTEGER, DIMENSION(N) :: X
OPEN (1,FILE="fake.dat",STATUS="OLD")
DO I=1,N
READ(1,"(5I3)",end=10) X(I)
END DO
10 do I=1,N
print *, X(I)
end do
END PROGRAM test
This is my dataset. The data is separated with a space in each row.
21 23 40 41 78
53 10 79 25 36
42 28 17 30 99
11 22 33 44 55
And this is my output:
11
22
33
44
55
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
I promise that I am not a student trying to get homework help. I am currently sitting in my cubicle trying to resist the temptation of punching my monitor out of frustration. Thanks in advance for the help.
Last edited: