5

My Octave crashes when I execute plot command. I found a solution in Assad Ebrahim's answer. He mentioned to switch the default toolkit to gnuplot, and change it in octave.rc file if I want to make the change permanently but I'm not clear about the permanent change in octaverc. When I open my octaverc with notepad++, it looks like this:

## System-wide startup file for Octave.
##
## This file should contain any commands that should be executed each
## time Octave starts for every user at this site.
EXEC_PATH (cstrcat (fullfile (OCTAVE_HOME, 'notepad++'), pathsep, 
EXEC_PATH));
EXEC_PATH (cstrcat (fullfile (OCTAVE_HOME, 'bin'), pathsep, EXEC_PATH));
EDITOR (fullfile (OCTAVE_HOME, 'notepad++', 'notepad++.exe'));

What should I change and how?

Community
  • 1
  • 1
Melinda W
  • 75
  • 2
  • 2
  • 7
  • 1
    graphics_toolkit("gnuplot") – Michael Apr 23 '17 at 11:28
  • 2
    why do you say "Octave crashes"? Do you see a segmentation fault? Windoue users usually tend to call everything they don't understand a "crash". If you use the GNU Octave GUI for the first time to plot something it creates a fontconfig cache which may take up to 3 minutes. In this time you'll see an empry (perhaps unresponsive) plot windows). Please be patient and wait at least 3min after your first "plot" command – Andy Apr 23 '17 at 14:27
  • 2
    Thanks your @Andy attention.You are right.I try again,and Octave takes about 8 minutes to plot.I thought "Octave crashes" because it was unresponsive after a plot window appeared and I cannot close Octave as usual. – Melinda W Apr 24 '17 at 00:58

1 Answers1

9

First, the direct answer to your question is to append any command you want executed on startup to the end of the .octaverc file. So, to set a particular graphics toolkit you would add the line:

graphics_toolkit("gnuplot")

Or

graphics_toolkit("qt")

Or

graphics_toolkit("fltk")

For whichever toolkit you want.

Now, as pointed out by @Andy, if you are using Windows, it may be that you are misinterpreting a long delay for a crash. A still not entirely resolved windows bug concerns the fact that on the first plot Windows might need to create a font cache file. This can take a long time. Once this is complete, most subsequent plots will be much faster. Some info can be found about it at the following bug report page: https://savannah.gnu.org/bugs/?45458

EDIT: in the time since this answer was posted, the bug linked above has been largely resolved. Part of the installation process now updates the font-cache file. If using a zip package rather than an executable installer, there is a batch file that should be run after extracting octave to ensure that this is done. Details are available at: http://wiki.octave.org/Octave_for_Microsoft_Windows

Nick J
  • 1,310
  • 12
  • 25
  • 1
    Thank you for your thorough and detailed answer! It was my first time to use stackoverflow, and did'n't expected it to be answered so fast.Thank you again – Melinda W Apr 24 '17 at 01:12