Re: Help: Hwo to write double quotation marks ("") into a text file using function asciiwrite?

From: lxf <heaven_bird334_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 21 2011 - 09:26:15 MDT

Dear Rick,
       It works! Great!
       Thank you so much!

Best Regards,
Li
2011-04-21

-------------------------------------------------------------
ˣRick Brownrigg
ڣ2011-04-21 22:51:05
ռˣlxf
ͣncl-talk
⣺Re: [ncl-talk] Help: Hwo to write double quotation marks ("") into a text file using function asciiwrite?

You can do something like

quote = inttochar(34)
lines(0) = "step =>" + quote + 0 + quote

Hope that helps...
Rick

On Apr 21, 2011, at 8:44 AM, lxf wrote:

> Dear All,
> I met a proplem in writing strings into a file. The sting I want to output stings into a file, but didn't succeed because the double quotation marks ("") in the string can't be defined. The strings is a line like this:
>
> step => "0",
>
> So, my ncl scripts is as following:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> begin
> lines = new(22,string)
> lines(0) = "step => "0","
> asciiwrite ("foo", lines)
> end
>
> And the wrong informations is as following:
>
>> ncl -x t.ncl
> Copyright (C) 1995-2010 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.2.1
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> +
> Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> +
> Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> +
> Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> +
> + begin
> + lines = new(22,string)
> fatal:syntax error: line 7 in file t.ncl before or near 0
> lines(0) = "step => "0
> -----------------------------^
>
> + lines(0) = "step => "0","
> + asciiwrite ("foo", lines)
> + end
> fatal:Syntax Error in block, block not executed
> fatal:error at line 9 in file t.ncl
>
>
>
> Any help or suggestion is appriciatble.
> Have a good day!
>
> Sincerely,
> Li
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

.
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 21 09:27:51 2011

This archive was generated by hypermail 2.1.8 : Tue May 03 2011 - 14:47:35 MDT