Is there a way to have procedures (or C-like functions) in Gnuplot? I need something really simple, just something like:
function func1()
{
var1 = "string1";
var2 = var1."string2";
return var2;
}
to make my gnuplot scripts a little bit more compact.
Gnuplot supports (simple) functions with arguments:
More complicated “inline” functions can be created if you’re using gnuplot 4.4:
In this form, the last portion of the function is what is returned (
var1.var2) and the statements are evaluated left to right.If you want to have functions which accept no parameters, you can (often) use macros: