[ncl-talk] write_table format option & write_matrix appending

Zhifeng Yang yangzf01 at gmail.com
Wed Jul 29 19:12:30 MDT 2015


Hi Mary,

This is really a great alternative way to accomplish it. Thank you very much

Best,
Zhifeng

On Wed, Jul 29, 2015 at 6:02 PM, Mary Haley <haley at ucar.edu> wrote:

> I don't know if there's an easy way to do an array of numbers.
>
> To make the format string easier, you could do something like:
>
> ;---Create format string for a list of elements in a List variable. format_array
> = new(ListCount(alist),string)
> format_array = "%16.f"
> format_str   = str_join(format_array,"")
>
> write_table("list.txt", "a", alist, format_str)
>
>
> On Tue, Jul 21, 2015 at 4:39 PM, Zhifeng Yang <yangzf01 at gmail.com> wrote:
>
>> Hi
>>
>> 1. I use write_table to write array into a text file. Since I need to
>> write 10 columns of float data, I use the following format.
>>
>> write_table("list.txt", "a", alist, 10"%16.2f")
>>
>> Unfortunately, NCL can't realize it. The error occurs. Then I use the
>> following format, and it works
>>
>> write_table("list.txt", "a", alist, "%16.2f%16.2f%16.2f%16.2f%16.2f%16.2f%16.2f%16.2f%16.2f%16.2f")
>>
>> However, the second one is really tedious. Do you know what is the best
>> way to use format in write_table?
>>
>> 2. I also want to use write_matrix. Unfortunately, I don't find how to
>> use appending with write_matrix. Do you know whether there is appending
>> feature for write_matrix?
>>
>> Thank you
>> Zhifeng
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150729/edd8ac93/attachment.html 


More information about the ncl-talk mailing list