It's not a bug, but a feature: How do I get a plot (Mac Version)

schroeder@kabelbw legoesprit at kabelbw.de
Sat Jun 13 05:11:29 CDT 2009


Dear support,

since several months I've tried to figure out how to interact easily  
with octave by using a comfortable text editor. Just yesterday I  
succeeded with version 3.2.0 and Textwrangler.

Prerequisites:
===========
Install octave.app and gnuplot.app into an appropriate directory: I  
am using: /Applications/Mathematik/Octave

Working:
=======
Under these conditions octave is working when being called as:
/Applications/Mathematik/Octave/Octave.app/Contents/Resources/bin/octave

from within the octave command lines. Even graphical output occurs  
correctly in an Aqua terminal. Unfortunately executing an *.m file  
directly from the terminal command line no graphics is being  
displayed. For example:

 > cat firstTest.m
#! /Applications/Mathematik/Octave/Octave.app/Contents/Resources/bin/ 
octave -qf
x = [-pi:0.1:pi];
plot (x, sin (x), "g");
 > /Applications/Mathematik/Octave/Octave.app/Contents/Resources/bin/ 
octave firstTest.m

does not produce any output, nethertheless the start-up messages from  
octave a properly monitored into the terminal. As well using a  
shebang line from Textwrangler does not work!

Reason: The octave command finishes before the Aqua terminal took over.

Circumvention:
============
Add another line to the file as:

#! /Applications/Mathematik/Octave/Octave.app/Contents/Resources/bin/ 
octave -qf
x = [-pi:0.1:pi];
plot (x, sin (x), "g");
b = waitforbuttonpress ();			# Otherwise no plot occurs!

Now together with the shebang line the file is executed properly and  
graphics out is being displayed in an Aqua terminal. Now this works  
even from the #! Run menu directly from Textwrangler.

Could you please be so kind to add this to a help instruction? I  
guess it will help others a lot!

Thanks a lot for your support.

Best regards

legoesprit






More information about the Bug-octave mailing list