Re: str_write

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Fri Oct 12 2012 - 09:04:14 MDT

Virginie,

You may want to change your script to:

a = (/111, 222, 333, 444/)
b = (/1.1, 2.2, 3.3/)
c = (/"a", "b", "c"/)
d = (/11h, 22h/)
f = (/11l, 22l, 33l, 44l, 55l, 66l/)

alist = [/a, b, c, d, f/]
header = (/"--------------------------------", \
           "This is a file header", \
           "--------------------------------"/)
footer = (/"--------------------------------", \
           "This is a file footer", \
           "--------------------------------"/)

hlist = [/header/]
flist = [/footer/]

do it=0,2,1
filename= "test_" + it + ".txt"
str_write(filename, "w", hlist, "%s")
str_write(filename, "a", alist, "%d%16.2f%s%d%ld")
str_write(filename, "a", flist, "%s")
end do

Wei

huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Oct 12, 2012, at 8:22 AM, virginie hergault wrote:

> do it=0,2,1
>
>
>
> a = (/111, 222, 333, 444/)
> b = (/1.1, 2.2, 3.3/)
> c = (/"a", "b", "c"/)
> d = (/11h, 22h/)
> f = (/11l, 22l, 33l, 44l, 55l, 66l/)
>
> alist = [/a, b, c, d, f/]
> header = (/"--------------------------------", \
> "This is a file header", \
> "--------------------------------"/)
> footer = (/"--------------------------------", \
> "This is a file footer", \
> "--------------------------------"/)
>
> hlist = [/header/]
> flist = [/footer/]
> filename= "test_" + it + ".txt"
> str_write(filename, "w", hlist, "%s")
> str_write(filename, "a", alist, "%d%16.2f%s%d%ld")
> str_write(filename, "a", flist, "%s")
>
> end do

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Oct 12 09:04:29 2012

This archive was generated by hypermail 2.1.8 : Fri Oct 12 2012 - 15:38:19 MDT