Function vs Sub-script

Boyin Huang boyin.huang at NOAA.GOV
Fri Jun 3 15:36:07 EDT 2005


I tried to pass a multi-words string to a subscript. the reason is that
function can only be defined within the file that calls the function.

Here is my example:

----------------
*main script
mc1='i love you'
mc2='you love me'
xc = fn(mc1,mc2)
'fn.gs 'mc1' 'mc2

function fn(mc1,mc2)
say mc1
say mc2
return
-----------------
*sub-script fn.gs
function fn(args)
say args
return

====================================
grads output
i love you
you love me
i love you you love me

=======================================
Use subwrd(args,1) is an option, but difficult to control since the length
of string may change.

Is it possible to make the fn.gs script have the capability of a function?

Thanks



More information about the gradsusr mailing list