2016-04-08 42 views
0

我是一個非常新手八度。顯示八度數字窗口

我想顯示圖我與八度圖,但沒有數字窗口顯示。

這裏是我想繪製什麼,plot.m

x = load('ex2x.dat'); 
y = load('ex2y.dat'); 
figure % open a new figure window 
plot(x, y, 'o'); 
ylabel('Height in meters') 
xlabel('Age in years') 

我運行腳本的命令行直接

octave plot.m 

數據集可以從http://openclassroom.stanford.edu/MainFolder/DocumentPage.php?course=DeepLearning&doc=exercises/ex2/ex2.html

我下載按照網站的建議安裝了映像包。

我的操作系統是Ubuntu 14.04,我不確定我是否錯過了一些東西。

我很感激任何幫助。

謝謝!

+2

圖形渲染器可能有問題。你能確認你在Octave中選擇哪個圖形渲染器嗎?在Octave命令窗口中輸入'available_graphics_toolkits'。哪些可用?另外,當前作爲渲染器加載的內容是什麼?輸入:'loaded_graphics_toolkits'在你運行'plot'函數後,看看你得到了什麼。 – rayryeng

+0

我在'octave-cli'中輸入'available_graphics_toolkits',它顯示'ans = {1,1} = fltk }' –

+1

我輸入'loaded_graphics_toolkits',它顯示'ans = {}(1x0) '。 –

回答

2

我找到了答案,可以在Octave的FAQ中找到。

http://wiki.octave.org/FAQ

If you are running an Octave script that includes a plotting command, 
the script and Octave may terminate immediately. So the plot window 
does show up, but immediately closes when Octave finishes execution. 
Alternatively, if using fltk, the plot window needs a readline loop to 
show up (the time when Octave is sitting around doing nothing waiting for interactive input). 
A common solution is to put a pause command at the end of your script. 

所以我只在我的腳本的末尾添加pause,它顯示的窗口。

+0

很酷。感謝分享。 – rayryeng

+0

@ user3378223:或者添加--persist – Andy