Interactive Data Language - Array manipulation

200 views Asked by At

I have two arrays of the same length in IDL. I want to combine the two arrays pairwise so that I can then print the two arrays as columns to file. Is this possible?

1

There are 1 answers

2
Ludic On BEST ANSWER

You can combine two arrays (with same length n) like this :

combined = [[array1], [array2]]

so that combined is n x 2.

Although you can write your data without creating a third array:

openw, lun, 'path_to_file.ext', /get_lun
foreach elem, array1, index do begin
  printf, lun, elem, array2[index]
endforeach
free_lun, lun