CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

How to extract this data in fortran

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 6, 2009, 21:55
Default How to extract this data in fortran
  #1
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 105
Rep Power: 8
quarkz is on a distinguished road
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
quarkz is offline   Reply With Quote

Old   May 7, 2009, 01:59
Default
  #2
New Member
 
hwangkl
Join Date: Mar 2009
Location: taiwan
Posts: 16
Rep Power: 8
hwangkl is on a distinguished road
Quote:
Originally Posted by quarkz View Post
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
hwangkl is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
extract point data susan CD-adapco 4 November 27, 2007 15:04
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 18:27
Extract Values from ensight formatted data Fabian EnSight 8 September 13, 2005 13:14
automatic extract data in post colins CFX 0 January 14, 2004 10:47
Fortran: Seeking data in files. cfd guy Main CFD Forum 6 May 23, 2002 22:30


All times are GMT -4. The time now is 02:05.