I would like to read variables from a file in Fortran. For example I have one .txt file with multiple columns. I would like to set i.e.
x (for the first column)
y (for the secοnd column)
z (for the third column) etc.
The porpuse of this set is to create a code which would use one equation and after that it would makes claculation between x,y,z etc.
Could you please tell me which command should I use in order to make it?
I have to mention that every time I would not have the same dimension (number of lines and rows) files.
What I have tried:
The problem is that I have a file with 14 columns and 644 lines. I use these commands but my .exe file does not showing what I would like
I give you my code:
parameter (len=644)
dimension A(len,14)
character header*110,Var1(len)*4,Var2(len)*8,Var3(len)*8
+ ,Var4(len)*8,Var5(len)*8,Var6(len)*8,Var7(len)*8,Var8(len)*8,Var9(len)*8,
+ ,Var10(len)*8, Var11(len)*8,Var12(len)*8,Var13(len)*8,Var14(len)*8,header_append*97
open(7,file='testdata.txt',status='old')
open(8,file='EX-1.out',status='unknown')
do i=1,len
write(*,5) A(i,1)
end do
5 format(2x,f3.1)
do i=1,ip
write(*,5) A(i,1)
end do
stop
end
Could you please help me?