comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Printing array to text file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Printing array to text file [message #77445] Mon, 29 August 2011 14:36
Brian Wolven is currently offline  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 Go to previous message
Paul Van Delst[1] is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Printing array to text file
Next Topic: Re: Error help

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:12:05 PDT 2025

Total time taken to generate the page: 0.00591 seconds