I found IDL formatting online. According to the website I found, writing nX into a formatting command will cause it to skip n lines. Also it said that it would ignore quoted strings in the format while reading. So I tried this read statement:
readf, 1, FORMAT = '("IDL is great", 23x)', X
It told me that my command caused it to enter an infinite loop. Since when has telling a program to skip 23 characters and then to read a string caused anything to enter an infinite loop? Apparently the documentation on this is not very good.
Since IDL formatting doesn't work apparently, I just used the strmid function I talked about earlier to extract every single number from the string separately. To do this, I had to find the location of every single column in the document, and then to write a strmid function for each number in the column I wanted to read. My datasheet has 23 columns, so this is probably one of the stupidest solutions to a problem that has ever been used in a program. I had to write 23 strmid functions in order to extract all of it from my strings. This problem is so trivial that I would not even have had to think about how to do it in any other language, but when I use IDL I have to go through all this crap.
There is another stupid problem that I have had with IDL that I will share. The example below is a valid IDL statement:
for i = 0, N do begin
readf, y
x(i) = y
endfor
IDL does not accept this command however:
for i = 0, N do begin
readf, x(i)
endfor
I cannot imagine why IDL does this. I've worked briefly with about a dozen programming languages before, and IDL is by far the stupidest language that I have ever worked with. I would never pay to use this product. I am using a student version at my university.
|