Wednesday, July 6, 2011

Conditional statements

The syntaxis for writing conditional statements in GNUPLOT is:
  • if (<condition>) <command1>; <command2>; ...; else <command1>; <command2>; ...

List of conditions:
  eq  equal to (for strings)
  ne  non equal to (for strings)
  ==  equal to (for numbers)
  !=  non equal to (for numbers)
  <   lower than
  <=  lower than or equal to
  >   greater than
  >=  greater than or equal to

Combining several conditions:
  &&  and
  ||  or

Example:
  • if (FILE_NUM==1) \
  • 'whatever1.dat' u 1:2 w l lw 1 lt 3 notitle;\
  • 'whatever1.dat' u 1:3 w l lw 5 lt 1 notitle
  • if (FILE_NUM==2) \
  • 'whatever2.dat' u 1:2 w l lw 1 lt 3 notitle;\
  • 'whatever2.dat' u 1:3 w l lw 5 lt 1 notitle

No comments:

Post a Comment