samedi 30 septembre 2017

'else if' logical statements in gnuplot

The new gnuplot (5.x) has new syntax for logic, but I cannot get the 'else if' statement to work. For example:

if(flag==1){
plot sin(x)
}
else{
plot cos(x)
}

does work, but:

if(flag==1){
plot sin(x)
}
else if(flag==2){
plot cos(x)
}
else if(flag==3){
plot tan(x)
}

does not. I have tried many combinations of {} and placement of 'if' and 'else' to no avail. Does anyone know how to correctly implement 'else if' in gnuplot 5.x?

The gnuplot guide (http://ift.tt/2k9nAxu) has no examples of the new logic syntax using 'else if' but does have examples using the old syntax, but I would rather avoid the old.

Aucun commentaire:

Enregistrer un commentaire