Global variable

Diane Stokes diane.stokes at NOAA.GOV
Wed Jun 8 10:21:24 EDT 2005


Boyin,

Rename fn.gs to fn.gsf and add the following as the first line:
    function fn()

Regards,
    Diane Stokes


Boyin Huang wrote:
> I failed to define a global variable in Grads 1.85SL11.
>
> Here is the main script
> rc = gsfallow("on")
> _mc1='i love you'
> _mc2='you love me'
> 'fn.gs '
> say _mc1
> say _mc2
>
> Here is the sub-script "fn.gs" at the same directory
> say _mc1
> say _mc2
> _mc1='aa'
> _mc2='bb'
>
> Here is the output
> _mc1
> _mc2
> i love you
> you love me
>
> Obviously, _mc1 and _mc2 defined in the main script have not passed into
> the
> subscript, and those redefined in the subscript have not passed into the
> main script either.
>
> What is the problem?
>
> Kilian Hagemann wrote:
>
>> Boyin,
>>
>> Check out how to dynamically load script functions, it might solve your
>> problem:
>>
>> http://grads.iges.org/grads/gadoc/gsf.html
>>
>> --
>> Kilian Hagemann
>>
>> Climate Systems Analysis Group
>> University of Cape Town
>> Republic of South Africa
>> Tel(w): ++27 21 650 2748
>>
>>
>>
>
> --
> Boyin Huang, Oceanographer
> RSIS/NOAA CPC
> Room 605-A, WWB
> 5200 Auth Rd
> Camp Springs, MD 20746
> Phone: 301-763-8000 ext 7575
> Fax: 301-763-8395
> Email: boyin.huang at noaa.gov
>

--
Diane Stokes
Environmental Modeling Center
National Weather Service/NOAA



More information about the gradsusr mailing list