pro maccs_intro_ascii,filename,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,$ c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,c30,c31,$ c32,c33,c34,c35,c36,c37,c38,c39,c40,c41,c42,c43,c44,c45,c46,c47,c48,c49,$ c50,c51,c52,c53,c54,nskip=nskip,format=form,maxelem=maxelem,ascii=ascii ; ; This subroutine reads into idl an arbitrary ascii file ;EXAMPLES OF INPUT PARAMETERS: ; ; filename ; Input ascii file name ; skiplines ; Number of lines before occurrence of data in file. ; ; HARD NUMBERS if keyword_set(maxelem) then max_elements=maxelem else max_elements=500000l FLAG=6.8792E+28 PI=3.1415926535898 ; ; Find number of arrays to be read nras=n_params()-1 ; ; Read sequencially the elements of the array ; in order to find out how many points you have. ; (Alternative is simply: readf,unit,all) ; if (keyword_set(ascii)) then begin datarr=strarr(nras) a={elements:strarr(nras)} endif else begin datarr=dblarr(nras) a={elements:dblarr(nras)} endelse all=replicate(a,max_elements) unit=11 openr,unit,filename on_ioerror,SUM ncount=0l if keyword_set(nskip) then begin for j=1l,nskip do begin line="" readf,unit,line,format="(a160)" endfor endif if keyword_set(form) then begin START1: readf,unit,datarr,format=form all(ncount).elements=datarr ncount=long(ncount)+1l goto, START1 endif else begin START2: readf,unit,datarr all(ncount).elements=datarr ncount=long(ncount)+1l goto, START2 endelse SUM: close,unit ntotal=ncount ;print,"Data have been read. Total number of points:",ntotal ; for n=0l,nras-1 do begin dummy=execute("c"+strtrim(string(n),2)+"=all(0:ntotal-1).elements(n)") endfor ; return ; end