Getting octave to plot when invoking a function from the command line
Just use pause
after your plotting functions
You can use:
waitfor(h)
at the end, which waits for you to close the figure.
AFAIK, the plot window is a child process of octave and therefor can only be displayed when octave is running. Even if you plot something from the "interactive" mode leave the plot open and close octave, the plot will also disappear.
What you could do is to plot to some output file like posted here:
f = figure
set(f, "visible", "off")
plot([1,2,3,4])
print("MyPNG.png", "-dpng")