If control sequence under Gnuplot

How to perform control sequences under Gnuplot please? I need to make something like

if (x == nan)
  set xrange[]

else
  set xrange[10:30]

I tried something like

( x > 100000 ) ?  (set xrange[]) : (set xrange[10:30])

... buth without success! I spent hours trying to solve this!! Any help please? At worst I can create a shell script an manage this, but I think there should be some control sequences to fix this.

Answers


For gnuplot 4.4.4 the if statement must be on a single line:

if (x > 10000) set autoscale x; else set xrange [10:30]

or use \ to continue on the next line.

if (x > 10000) \
    set autoscale x; \
else \
    set xrange [10:30]

Since 4.6.0 gnuplot can use brackets to delimit the branches:

if (x > 10000) {
    set autoscale x
} else {
    set xrange [10:30]
}

Need Your Help

Which conditional compile to use to switch between Mac and iPhone specific code?

iphone xcode macos conditional-compilation

I am working on a project that includes a Mac application and an iPad application that share code. How can I use conditional compile switches to exclude Mac-specific code from the iPhone project and

How to specify floating point decimal precision from variable?

python string floating-point floating-point-precision

I have the following repetitive simple code repeated several times that I would like to make a function for: