Re: Printing array to text file [message #77445] |
Mon, 29 August 2011 14:36 |
Brian Wolven
Messages: 94 Registered: May 2011
|
Member |
|
|
I think you're going to need to specify a format with a fixed number of values and decimal places for each value if you want to generate nice even columns. I don't think that the default IDL format will provide that, unless the values are pretty uniform.
|
|
|
Re: Printing array to text file [message #77446 is a reply to message #77445] |
Mon, 29 August 2011 14:28  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
check out the WIDTH keyword to OPENW
cheers,
paulv
Alexa wrote:
> Hi All,
>
> When I'm printing an array to a text file it doesn't print in way that
> maintains the proper number of rows and columns.
>
>
> Here's what I'm doing to fill the array in IDL,
>
> ;;Open file with list of metallicities and put into an array
> ReadCol, "MetalsList.txt", Metal, Format='a'
> print, Metal
>
> ;;Create temporary arrays for the transitions
> O3arr=FLTARR(41,25)
>
> ;;Open the metals folders in order to read in col.txt
>
> for nt=0, N_ELEMENTS(Metal)-1 do begin
> cd, Metal[nt]
> ;;Read in column densities
> ReadCol, 'O3.cd', U, O3
>
> cd, '..'
>
> ;Fill arrays
>
> O3arr(nt,*)=o3
> endfor
>
> I think the problem is probably how I'm printing the array to a text
> file
>
> openw, lun, 'O3arr.txt', /GET_LUN
> printf,lun, O3arr
> close, lun & free_lun, lun
>
> Do you see anything here that would cause the array not to have the
> proper columns and rows?
>
> Thanks,
> Alexa
|
|
|