CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   How to extract this data in fortran (http://www.cfd-online.com/Forums/main/64314-how-extract-data-fortran.html)

quarkz May 6, 2009 22:55

How to extract this data in fortran
 
Hi,

I have some results output from a program

The data is usually

x y z

56.34 22.35 96.45

but sometimes it can be

56.34100.35 96.45

It should actually be 56.34 100.35 96.45 but there's a programming bug.

It's not possible to rerun due to the complication involved.

So how can I extract such that I can get
x=56.34, y=100.35, z=96.45?

I tried extracting "56.34100.35" as a character and then change to real. However if it is in the form of 56.34 22.35, this method will not work because the extracted character will only be "56.34" instead of "56.34 22.35"

Hope someone can help. Thanks

hwangkl May 7, 2009 02:59

Quote:

Originally Posted by quarkz (Post 215370)
Hi,

I have some results output from a program

The data is usually

x y z

56.34 22.35 96.45

but sometimes it can be

56.34100.35 96.45

It should actually be 56.34 100.35 96.45 but there's a programming bug.

It's not possible to rerun due to the complication involved.

So how can I extract such that I can get
x=56.34, y=100.35, z=96.45?

I tried extracting "56.34100.35" as a character and then change to real. However if it is in the form of 56.34 22.35, this method will not work because the extracted character will only be "56.34" instead of "56.34 22.35"

Hope someone can help. Thanks

open(1,file='input.txt')
read(1,*) a,b,c
write(*,*) a,b,c
end


All times are GMT -4. The time now is 23:55.