2

I am writing to a file in IDL. The file is written to after analysing data from the run of a code. I plan to run the code more than once, and collect the data into the same file after each run. How can I use IDL to do this? I implemented some code, but the data is just updated after each run. There is no recording of individual data.

fname='ratios.dat'
if (k eq 0) then begin
openw,21,fname
printf,21,Ratio_02,Ratio_12,FORMAT='(F6.4,2X,F6.4)'
endif else begin
openu,21,fname
printf,21,Ratio_02,Ratio_12,FORMAT='(F6.4,2X,F6.4)'
endelse

k is the iterating variable which has more than one value at a higher nested loop. The purpose of openu was my attempt to update the already produced file with additional data.

stars83clouds
  • 795
  • 1
  • 8
  • 25
  • What do you mean by IDL? In the CORBA sense, IDL is an "Interface Definition Language". It describes interfaces only. There is no way to specify what to do in IDL. So please clarify that. We also can't see what you've tried, so maybe post some code. – Brian Neal Sep 13 '13 at 20:39
  • I've done that a few times now, i failed to read the description for IDL. – stars83clouds Sep 13 '13 at 20:51
  • @BrianNeal, unless I am mistaken, the OP is referring to the Exelis product. – jstevenco Sep 13 '13 at 21:08
  • @jstevenco Originally it was just tagged IDL. That's kind of ambiguous. :) Glad he clarified. – Brian Neal Sep 13 '13 at 23:57

1 Answers1

1

This is possible if you use the /append keywork as part of the openw syntax and closing the file each time, viz:

fname='ratios.dat'
openw,21,fname,/append
printf,21,Ratio_02,Ratio_12,FORMAT='(F6.4,2X,F6.4)'
close,21
stars83clouds
  • 795
  • 1
  • 8
  • 25