octave linux下安裝運行問題

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)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章