comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Writing a modified .txt file issue
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Writing a modified .txt file issue [message #85384 is a reply to message #85359] Mon, 29 July 2013 23:49 Go to previous messageGo to previous message
Ahmet Hakan BAYRAK is currently offline  Ahmet Hakan BAYRAK
Messages: 3
Registered: July 2013
Junior Member
Thank you all for the answers. My aim is to plot histograms for differences of height of drilling data and parameters data each other. This is I can get so far. I remove the header part to not confuse you because it makes dirty all code. :)

pro hist

infile='drilling.txt'
n=FILE_LINES(infile)
a=fltarr(n)
b=fltarr(n)
c=fltarr(n)
d=fltarr(n)
a1=0.0
b1=0.0
c1=0.0
d1=0.0
openr, iunit, infile, /GET_LUN
FOR i=0, n-1 DO BEGIN
readf, iunit, a1, b1, c1, d1
a[i]=a1
b[i]=b1
c[i]=c1
d[i]=d1
ENDFOR
FREE_LUN, iunit
FOR i=0, n-1 DO BEGIN
openw, lun, 'output.txt', /GET_LUN
a2=TRANSPOSE(a)
b2=TRANSPOSE(b)
c2=TRANSPOSE(c)
d2=TRANSPOSE(d)
int=b2-a2
g=[a2, b2, c2, d2, int]
FORMAT="(2F12.5)"
PRINTF, lun, g
FREE_LUN, lun
END
END

This is my input file: drilling.txt. It has 770 lines with header:

hole_id from to Pr_1 Pr_2
2006/1 6 8.2 39.23 0.09
2006/1 12.25 14 39.16 12.06
2006/2A 2 5.9 59.17 0.42
2006/2A 5.9 8.7 51.02 0.61
2006/2A 8.7 11.7 49.8 0.97
2006/2A 13.05 14.5 38.18 0.05
2006/2A 14.9 18 38.31 0.47
2006/2A 21.75 23.2 40.89 0.3
2006/3A 5.75 7.8 39.89 0.63
2006/3A 8.7 11.5 44.87 0.16
2006/3A 34 36.2 29.76 0.27
2006/3A 36.2 38.9 56.35 0.67
2006/3A 53.25 54.7 31.61 4.16
2006/3A 54.95 55.9 55.51 2.56
2006/4 38.2 39.6 29.38 5.5

And this is my output file: output.txt: In the output file I didn't remove header to show how it doesn't match.

from to pr_1 pr_2 int
6.00000 8.20000 39.2300 0.0900000 2.20000
12.2500 14.0000 39.1600 12.0600 1.75000
2.00000 5.90000 59.1700 0.420000 3.90000
5.90000 8.70000 51.0200 0.610000 2.80000
8.70000 11.7000 49.8000 0.970000 3.00000
13.0500 14.5000 38.1800 0.0500000 1.45000
14.9000 18.0000 38.3100 0.470000 3.10000
21.7500 23.2000 40.8900 0.300000 1.45000
5.75000 7.80000 39.8900 0.630000 2.05000
8.70000 11.5000 44.8700 0.160000 2.80000
34.0000 36.2000 29.7600 0.270000 2.20000
36.2000 38.9000 56.3500 0.670000 2.70000
53.2500 54.7000 31.6100 4.16000 1.45000
54.9500 55.9000 55.5100 2.56000 0.950001
38.2000 39.6000 29.3800 5.50000 1.40000
39.6000 40.4000 32.1900 3.96000 0.800003

Thank you for now,

Hakan
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Find all user-defined structure definitions
Next Topic: Multiple plots with plot function

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 11:37:37 PDT 2025

Total time taken to generate the page: 0.72101 seconds