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

Home » Public Forums » archive » appending contents in to a 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
appending contents in to a file [message #93187] Tue, 10 May 2016 02:01 Go to next message
Sapna Mishra is currently offline  Sapna Mishra
Messages: 66
Registered: December 2015
Member
Hello All,

How can I append contents into a file using forprint?
What I want to do...
For eg.

a=findgen(100)
b=findgen(100)

forprint, 'Numbers are:', text='tt.dat'
forprint, a,b,text='tt.dat'

I want all these to be appended in same file named tt.dat here.
How can I do??
Re: appending contents in to a file [message #93188 is a reply to message #93187] Tue, 10 May 2016 05:49 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
Right now, you have to open the file yourself, set !TEXTUNIT to the unit number and use TEXTOUT = 5 when calling forprint
http://idlastro.gsfc.nasa.gov/ftp/pro/misc/forprint.pro

For example

openw,12,'test.dat'
!textunit = 12
forprint,indgen(12),text=5
forprint,indgen(5)^2,t=5,/nocomment
close,12

I should probably just add an /append keyword to make it a little more straightforward. --Wayne

On Tuesday, May 10, 2016 at 5:01:25 AM UTC-4, Sapna Mishra wrote:
> Hello All,
>
> How can I append contents into a file using forprint?
> What I want to do...
> For eg.
>
> a=findgen(100)
> b=findgen(100)
>
> forprint, 'Numbers are:', text='tt.dat'
> forprint, a,b,text='tt.dat'
>
> I want all these to be appended in same file named tt.dat here.
> How can I do??
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: TEST
Next Topic: Time AXIS Monthly Ticks

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

Current Time: Wed Oct 08 09:11:47 PDT 2025

Total time taken to generate the page: 0.00461 seconds