1安装gnuplot用于plot画图
https://sourceforge.net/projects/gnuplot/files/gnuplot/
2安装octave
https://octave.en.softonic.com/download
3 运行时plot错误
octave:1> x = [1 4 90]
x =
1 4 90
octave:2> plot(x)
error: popen2: popen2 (child): unable to start process -- No such file or directory
error: called from:
error: octave-3.8.1/scripts/plot/util/private/__gnuplot_open_stream__.m at line 30, column 40
error: octave-3.8.1/scripts/plot/util/__gnuplot_drawnow__.m at line 72, column 19
sh: 1: : Permission denied
error: 'unset' undefined near line 1 column 1
warning: broken pipe
octave-3.8.1/scripts/plot/util/private/__gnuplot_open_stream__.m
进行临时修改:
27 function plot_stream = __gnuplot_open_stream__ (npipes, h)
28 [prog, args] = gnuplot_binary ();
29 if (npipes > 1)
30 [plot_stream(1), plot_stream(2), pid] = popen2 ("gnuplot", args{:});
31 if (pid < 0)
32 error ("__gnuplot_open_stream__: failed to open connection to gnuplot");
33 else
34 plot_stream(3) = pid;
35 endif
36 else
37 plot_stream = popen (sprintf ("%s ", prog, args{:}), "w");
38 if (plot_stream < 0)
39 error ("__gnuplot_open_stream__: failed to open connection to gnuplot");
40 endif
41 endif
42 if (nargin > 1)
43 set (h, "__plot_stream__", plot_stream);
44 endif
45 endfunction
也可以设定(gnuplot_binary()为具体的plot执行体)
octave:1> gnuplot_binary ('gnuplot');
octave:2> x = [1 30 980]
x =
1 30 980
octave:3> plot(x)