Textual Output in IDL

QUESTION: I'm facing a problem trying to write an array of 25 columns by 300 rows to a file. I need to save this array in a text file for further analysis. My problem is that IDL only creates five or six columns of data in my output file. I'm using PrintF to write the file. Is this a limitation of IDL?

ANSWER: No, it is not a limitation. It is probably a misunderstanding. :-)

IDL has a default line width of 80 columns. The reason for this probably goes back to before you were born, but in the old days we had to write our programs on punch cards which were only 80 columns wide. We couldn't be as verbose as we are today, nor did we have as much to say, I think. The 80 column width doesn't make much sense these days, but it seems to be a legacy from the good ol' days when you really didn't want to make a mistake typing your punch card. (Have you noticed that older programmers are much better typists than young programmers?)

In any case, if you need a wider output line, you ask for it with the WIDTH keyword to the OPENW command. If you are using a format of F9.4 for your data, you will probably need an output line of something like 10*25=250 columns. You would get it like this:

   OpenW, lun, 'myfile.txt', /Get_LUN, WIDTH=250
   PrintF, lun, mydata, FORMAT='(25(F9.2,x))'
   Free_LUN, lun

Web Coyote's Guide to IDL Programming