How to save variables to ASCII

Goodson,Ron [Edm] Ron.Goodson at EC.GC.CA
Fri Oct 2 18:18:10 EDT 2009


I thought fwrite was for binary files.
 
Anyway I just use something like
 
MyFile = "MyFileName"
'set gxout print'
'set prnopts %6.1f 17'  (these are just examples .. change to whatever
format with however many values per line you want ..)
'd  wind'
rc = write(MyFile, result)
 
 
That will put your ascii values in the file "MyFileName".  There will be
the 2 grads header lines before the data you'll have to strip out.
There will be 17 values per lines, since that was what was specified in
the prnopts.  It probably makes more sense to set that equal to the
number of elements along X.
 
ron
 
 
 
 

________________________________

________________________________

From: Wansang Ryu <wansryu at GMAIL.COM>
To: GRADSUSR at LIST.CINECA.IT
Sent: Friday, October 2, 2009 3:51:11 PM
Subject: How to save variables to ASCII



        Dear users,
	
        I am a beginner of GRADS, so I have lots of questions.
        One of them is that I want to save a variable (or variables) to
an ASCII file.
        I read that fwrite would work, but I don't know how to use it.
	
        I define a variable named 'wind' as below.
	
        define wind = ave(mag(uwind,vwind),t+0,t=360,12)
	
        I want to save the variable 'wind' to ASCII.
        I just used 'set fwrite' command, but I don't see any new file
in my directory.
	
        Anybody can help me?
	
        Wansang
	
        ---
        College Station, TX 77843-3147
        Office: 305A CSA (Teague) Bldg
        (979) 845-2719
	





-- 
Ph.D. Candidate
Department of Geography
Texas A&M University
College Station, TX 77843-3147
Office: 305A CSA (Teague) Bldg
(979) 845-2719

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20091002/aaae93de/attachment.html 


More information about the gradsusr mailing list