Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading a number in a file

Status
Not open for further replies.

albert1981

New member
Feb 16, 2007
61
Hallo everybody,

I would like to know how can I take a value from a text file like this in fortran:


text
number text number

output

1 3.4556 4.55555
2 3.2222 3.00000

text numbers
numbers ecc...


How can i do if I want to search for the value 3.000?

thanks,
Albert
 
Replies continue below

Recommended for you

Do you have an example of the input file?
 
Dear all,

I have to read an exponential number in fortran:

3.435335355E-02

I try to read it with a E format but It gave me some problems,

Thanks,
Albert
 
Dear xwb,

I have to read numbers like this:

366 6.0898E-03 0.000
367 5.9922E-03 0.000
368 5.8798E-03 0.000
369 5.7485E-03 0.000
370 2.1932E-02 0.000
371 2.1872E-02 0.000
372 2.1733E-02 0.000
373 2.1471E-02 0.000
374 2.1132E-02 0.000
375 2.0666E-02 0.000
376 2.0127E-02 0.000
377 1.9461E-02 0.000
378 1.8727E-02 0.000
379 1.7886E-02 0.000
380 1.6991E-02 0.000

the second column sometimes has e-02 and sometime e-03 I'm trying to use e format but it gave me differents numbers do you know how can I do?

Thanks again,
albert
 
Albert,

Surely a free format read statement can be used here:-

Read(5,*)I,A,B

will happily read each line of your file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor