[Thread Prev][Thread Next][Index]
Re: string arrays
Hello Hein,
Yes, starting with Ferret version 5.4 you can create a
string variable array. Please see the entry "string variables, arrays"
in the index to the Users Guide:
http://ferret.pmel.noaa.gov/Ferret/Documentation/Users_Guide/current/fer_html.htm
For example:
yes? use coads_climatology
yes? let mnames = {"January", "February", "March"}
yes? repeat/L=1:3 (let mon = mnames[i=`L`]; plot/L=`L`/title=`mon` sst[x=0])
Note that the string variable is defined by default on an abstract
X axis, so if we tried to set the context X=0 for SST using
PLOT/X=0, or SET REGION, Ferret would apply the X=0 to
the variable mnames as well, and not be able to loop through it.
One could also use TSEQUENCE to put the string on a time
axis, and then it's a bit simpler, as the L index applies to mnames
as well as sst:
yes? use coads_climatology
yes? let mnames = TSEQUENCE({"January", "February", "March"})
yes? repeat/L=1:3 (plot/L=`L`/X=0/title=`mnames` sst)
Hein Zelle wrote:
> Is there a way to put text strings in an array? I would like to be
> able to access the names of the months through a numerical (loop)
> index, so I can do something like this:
>
> repeat /l=1:12 (plot /set_up climatology; ppl title monthnames[`l`]; ppl
> plot)
>
> Is this possible in any way?
> Hein Zelle
>
> >-----------------------------------------------------------------<
> Hein Zelle
> Dept. of Oceographic Research
> KNMI, The Netherlands
> work: zelle@knmi.nl http://www.knmi.nl/~zelle
> private: hein@icce.rug.nl http://www.icce.rug.nl/~hein
> Phone: +31 (0)30 2206704
> >-----------------------------------------------------------------<
> --------------------------------------------------------------
> Zie ook/see also: http://www.knmi.nl/maildisclaimer.html
--
Ansley Manke Pacific Marine Environmental Laboratory Seattle WA (206)526-6246
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement