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

Home » Public Forums » archive » Writing formatted text files
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
Writing formatted text files [message #18891] Fri, 11 February 2000 00:00
Bernard Puc is currently offline  Bernard Puc
Messages: 65
Registered: January 1998
Member
Hi all,

I'd like to speed-up the following code. I'm writing comma delimited
text files, I'm eliminating whitespace by using strtrim, and am
explicitly formatting the string using a format keyword. Any ideas how
to improve this? I've been playing with various ways of formatting
without using a FOR loop but either don't get the desired output or the
error message telling me the output string has been truncated to 1024
lines.

data_to_write = fltarr(3, 100000)
FOR j=0, 99999 DO BEGIN
PRINTF,Lun,$
strtrim(string(data_to_write[0,j],format='(f10.3)'),2),',',$
strtrim(string(data_to_write[1,j],format='(f10.3)'),2),',',$
strtrim(string(data_to_write[2,j],format='(f10.3)'),2),$
FORMAT = "(a,a,a,a,a)"
ENDFOR

Output should look like this:

278.980,-232.018,258.090
278.926,-231.974,258.360
278.889,-231.944,241.240
278.852,-231.913,206.900
278.814,-231.883,156.390
278.776,-231.852,93.680
278.739,-231.821,27.799
278.702,-231.791,-33.771
278.664,-231.760,-84.551
278.626,-231.729,-121.161
...

Thanks.

--
Bernard Puc AETC, INC.
bpuc@va.aetc.com 1225 Jefferson Davis Highway #800
(703) 413-0500 Arlington, VA 22202
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Writing formatted text files
Next Topic: Brains Wired Differently Was: REPLICATE with arrays

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

Current Time: Wed Oct 08 18:41:56 PDT 2025

Total time taken to generate the page: 0.00467 seconds