Search code examples
gnuplot

if statement with a string-type condition for gnuplot for windows


Sorry if this looks like too of a beginner question: I've got an if statement like this:

season = 'WINTER'
if (season = 'WINTER') {
m1 = 'dic'
{

but gnuplot (for windows) just ignores it. It doesn't even bother itself to give me a warning/error message. I've tried == rather than just one '=', too; I've removed the {} brackets, I've tried {m1 = 'dic'} all together... nothing. When I write

print m1

I get 'undefined variable: m1'


Solution

  • season = 'WINTER' assign the string value 'WINTER' to the variable season. To test for string equality you want if (season eq 'WINTER') {...}.