appending contents in to a file [message #93187] |
Tue, 10 May 2016 02:01  |
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  |
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??
|
|
|