2016-09-15 75 views
0

我正在終端中運行Matlab代碼,因爲稍後我需要在php中調用此代碼。但是我得到這些錯誤:MATLAB ::在-nojvm啓動選項下不再支持此功能

[email protected]:~/Desktop/v1.2$ matlab -nojvm < matlab.m 

錯誤:

L2 norm on unsampled vertices: 0.096158 
>> >> >> >> >> >> Error using figure 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

>> Error using gcf 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in newplot (line 63) 
    fig = gcf; 

Error in scatter>localGetAxesInfo (line 102) 
    cax = newplot(cax); 

Error in scatter (line 82) 
     [~,parax] = localGetAxesInfo(cax); 

>> >> >> >> Error using gca 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in title (line 22) 
    ax = gca; 

>> Error using gca 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in hold (line 34) 
    ax = gca; 

>> >> >> Error using figure 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

>> Error using gcf 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in newplot (line 63) 
    fig = gcf; 

Error in scatter>localGetAxesInfo (line 102) 
    cax = newplot(cax); 

Error in scatter (line 82) 
     [~,parax] = localGetAxesInfo(cax); 

>> >> >> >> Error using gca 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in title (line 22) 
    ax = gca; 

>> Error using gca 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in hold (line 34) 
    ax = gca; 

>> >> Error using figure 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

>> Error using gcf 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in newplot (line 63) 
    fig = gcf; 

Error in scatter>localGetAxesInfo (line 102) 
    cax = newplot(cax); 

Error in scatter (line 82) 
     [~,parax] = localGetAxesInfo(cax); 

>> >> >> >> Error using gca 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in title (line 22) 
    ax = gca; 

>> Error using gca 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in hold (line 34) 
    ax = gca; 

>> >> Error using figure 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

>> Error using gcf 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in newplot (line 63) 
    fig = gcf; 

Error in scatter>localGetAxesInfo (line 102) 
    cax = newplot(cax); 

Error in scatter (line 82) 
     [~,parax] = localGetAxesInfo(cax); 

>> >> >> >> Error using gca 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in title (line 22) 
    ax = gca; 

>> Error using gca 
This functionality is no longer supported under the -nojvm startup option. For 
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release 
Notes. To view the release note in your system browser, run 
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', 
'-browser'). 

Error in hold (line 34) 
    ax = gca; 

能否請您指導我如何解決這個問題或者我怎麼回事,可以運行PHP中的Matlab代碼?目前我能夠從php運行如ls -ltr這樣的命令並查看網頁上的結果!

回答

2

根據收到的錯誤消息,不再支持使用-nojvm的Handle Graphics。您應該使用-nodesktop

在你的環境中,它應該是:

[email protected]:~/Desktop/v1.2$ matlab -nodesktop < matlab.m 

http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6

這裏是受影響功能的摘要:

  • 創建人物和執行繪圖任務,如使用繪圖,座標軸,getframe和gcf函數。
  • 打印數字和使用相關函數,如print,hgexport和saveas。
  • 使用GUI構建函數(如warndlg)在MATLAB中創建GUI。 使用Simulink示波器並打印Simulink模型。
+0

'-nojvm'仍然被支持,它只是* graphics *當使用'-nojvm'時不支持,下面的答案詳細說明了這一點。 – Suever

2

您已禁用更新版本的MATLAB中圖形所需的JVM。如果您需要圖形但不想使用IDE,可以使用-nodesktop -nosplash啓動MATLAB。 -nosplash選項可確保MATLAB啓動畫面不顯示。

matlab -nodesktop -nosplash 
+0

雖然這不會產生錯誤,但它也顯示沒有數字。如何使用像shell_exec('ls -lart')'這樣的php shell exec運行此命令時顯示數字? –

+1

@MonaJalal我以爲你不想顯示數字。我已經修改了它(如果你仍然看不到數字,你需要用set(0,'defaultfigurevisible','on')' – Suever

+0

來重置圖形可見性,請看看這個http:// stackoverflow .com/questions/39520695/error-error-creating-bundle-cache-java-lang-runtimeexception-unable-to-creat –