function writeada, ada, data COMPILE_OPT IDL2 ON_ERROR, 0 sz = size(data) xsize = sz[1] ysize = sz[2] openw, unit, ada, /get_lun for x=0, xsize-1 do begin for y=0, ysize-1 do begin if data[x,y] gt 0 then begin for i=0, data[x,y]-1 do begin if i eq 0 then d=uint([y,x]) else d = [d,uint([y,x])] endfor writeu, unit, d endif endfor endfor free_lun, unit end