I deleted the frame in which there was a plot so now I can export it to
a graphic file. In the left frame with checkboxes I added a pushbutton.
I wanted to use it to export current view of the plot (as I can change
the visibility of its elements with the checkboxes). I added a callback
function for the pushbutton as below:
The plan was to add a number to a file name. The number would increase
with every export so I could produce different pictures from the plot. A
variable n_ex is initialized with zero outside the callback function.
Unfortunately something is wrong here because when I use the pushbutton
I get a prompt: "Undefined variable: n_ex".
The whole definition of the figure and plot is inside a function - maybe
it's also an important information.