[Thread Prev][Thread Next][Index]

How to compare a string?



Hi all ferret users
I need to compare a string variable and then accordingly continue my code.
Here is my code in a file named test.jnl

use mb1.nc
let a=strcmp($1,"yes")
if `a eq 0` then
plot/z=0/t="01-Jan-2003":"01-Dec-2003"/title="welcome" air_temperature
endif

When I ran it, I got error message like below.


yes? go test yes
use mb1.nc
let a=strcmp($1,"yes")
!-> DEFINE VARIABLE a=strcmp(yes,"yes")
if `a eq 0` then
**ERROR: variable unknown or not in data set: YES
if `a eq 0` then
Command file, command group, or REPEAT execution aborted
yes?

I also tried the statement
if `$1 eq yes`, but it didn't work either.
Anybody can help me about this?
Thanks a lot, Ding





[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement