Re: Writing a modified .txt file issue [message #85368 is a reply to message #85359] |
Mon, 29 July 2013 11:35   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ahmet Hakan BAYRAK writes:
>
> Hi everyone I started to learn IDL 2 weeks ago and I'm at zero level. :) I think my problem must be easy but I couldn't solve anyway. :( I hope I can express my problem properly. I have a .txt file like this:
>
> 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
> . . . . .
> . . . . .
>
> These are my problems: I can't read the first column as string. With "file_lines" I can read other columns as floating array after seperated the first column on excel so I can seperate them in IDL and do calculations on these columns. At the beginning my header line is 5 columns but after my calculations, modifications my header line must be 7-8 columns. How can I do write in my output file? Also when I wrote the header and data they don't match, seems like this:
>
> 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
> . . . . .
> . . . . .
>
> (The fifth column is difference of "to" and "from" columns)
>
> I am at the beginning on IDL and I want to learn please help me. Forgive me for my English.
The person who wrote this data file is not your friend. You should avoid
associating with them from now on.
They gave you something that may look easy, but is, in fact, very
difficult. Plus, you don't know much about IDL yet, so I would say this
task is nearly impossible for you. I'm glad it is not the first thing I
had to do when I was starting out learning IDL. (I had to read the
entire User Guide--twice--when I was starting out before I could do
something useful in IDL, but the User Guide was much smaller in those
days.)
In any case, this is going to be difficult to explain to you, mostly
because you probably don't have the IDL vocabulary and knowledge for us
to communicate effectively with you. It might be easiest if you would
post or send me the first 15 lines or so of this file, so I can write an
example program that reads it. I'll post it on my web page for others to
learn from as well.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|