Skip to content

Instantly share code, notes, and snippets.

@adamabernathy
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save adamabernathy/19537bb74a3d8d8a6f0c to your computer and use it in GitHub Desktop.

Select an option

Save adamabernathy/19537bb74a3d8d8a6f0c to your computer and use it in GitHub Desktop.
Save a value to a CSV file
; We have an array of values to save to a CSV file
delim = ','
output_file = 'orbits.txt'
data_to_save=make_array(2, /string, value=-999)
data_to_save[0] = string(orbit_syear)
data_to_save[1] = string(orbit_sdoy, format='(I03)')
data_to_save[2] = string(orbit, format='(I05)')
s=''
lim = n_elements(data_to_save)
for i = 0, lim - 1 do begin
if i lt lim then begin
s = s + data_to_save[i] + delim
endif else begin
s = s + data_to_save[i]
endelse
endfor
; Write out info to rundates-aux file
openw, 1, output_file, /append
printf, 1, s
close, 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment