hi,
I have two text files: file 1 is shown below.It has 50 columns each column having different number of datapoints
10 20 30 40
10 20 30 40
10 20 30 10
10 20 10 05
10 20 05
10
10
10
10
10
File 2 currently look like this:
45
45
10
Now what I want to do is
Step 1: Start a loop from n = 1 to 50 (1 run for each column)
Step 2: read column of file 1
Step 3: delete whatever is previously stored in file 2
Step 4: write the column read from file 1 in step 2 to file 2.
Step 5: repeat the same process again eg. read column 2 from file 1 and replace it in file2 and so on.
the problem is that different columns in file 1 have different number of datapoints. I know ALLOCATABLE arrays can be used to solve this problem but I am new in FORTRAN programming and unable to figure out how to read column data and allocate memory to array accordingly.
Any help would be appreciated. Solving this problem is very important for my research.
Thanks
Vibhava
I have two text files: file 1 is shown below.It has 50 columns each column having different number of datapoints
10 20 30 40
10 20 30 40
10 20 30 10
10 20 10 05
10 20 05
10
10
10
10
10
File 2 currently look like this:
45
45
10
Now what I want to do is
Step 1: Start a loop from n = 1 to 50 (1 run for each column)
Step 2: read column of file 1
Step 3: delete whatever is previously stored in file 2
Step 4: write the column read from file 1 in step 2 to file 2.
Step 5: repeat the same process again eg. read column 2 from file 1 and replace it in file2 and so on.
the problem is that different columns in file 1 have different number of datapoints. I know ALLOCATABLE arrays can be used to solve this problem but I am new in FORTRAN programming and unable to figure out how to read column data and allocate memory to array accordingly.
Any help would be appreciated. Solving this problem is very important for my research.
Thanks
Vibhava