2015-12-17 39 views
0

我正在使用GUIDE創建一個帶有GUI的已編譯MATLAB應用程序。我想在標有'幫助'的應用程序中打開一個合適的文檔。我目前有這個代碼在我的幫助按鈕後面:向已開發的MATLAB應用程序添加幫助

% --- Executes on button press in helpButton. 
function helpButton_Callback(hObject, eventdata, handles) 
    if exist('./my_prog_help.html/my_prog_help.html', 'file') 
    !start trip_vierer_help.html\trip_viewer_help.html & 
    elseif exist('./my_prog_help.txt', 'file') 
    !start trip_viewer_help.txt & 
    else 
    warndlg('Help file not found.','Help Not Found','modal') 
    uiwait(); 
    end 

這可以工作,但它會打開並打開Windows命令窗口。我可以阻止這個額外的窗口打開嗎?

或者,雖然這可行,但這必須是經常遇到的要求。有沒有其他人有更好的解決方案?

幫助文件多長。

我使用MATLAB r2014a與64位Windows 7

+1

我已經提出幾個月前[這個答案](http://stackoverflow.com/questions/25662093/displaying-custom-help-documentation-in-matlab/32157072#32157072);也許它可能會幫助你。 –

回答

0

而不是使用:

!start trip_viewer_help.html\trip_viewer_help.html &

嘗試使用:

[status,cmdout]=system('start trip_viewer_help.html\trip_viewer_help.html &');

+0

雖然這會根據需要打開瀏覽器或編輯器,但它也會打開一個不必要的命令窗口。 –

0

@il_raffa已經給出了答案部分是對另一個問題here的非常詳細的回覆。以下是我詳細問題的相關部分。我可以使用:

% --- Executes on button press in helpButton. 
function helpButton_Callback(hObject, eventdata, handles) 
    if exist('./my_prog_help.html/my_prog_help.html', 'file') 
    web(trip_vierer_help.html\trip_viewer_help.html','-browser') 
    elseif exist('./my_prog_help.txt', 'file') 
    winopen('trip_viewer_help.txt') 
    end 

這將在我的默認瀏覽器中打開html,並在我的默認編輯器中打開文本。

這也將工作:

% --- Executes on button press in helpButton. 
function helpButton_Callback(hObject, eventdata, handles) 
    if exist('./my_prog_help.html/my_prog_help.html', 'file') 
    winopen(trip_vierer_help.html\trip_viewer_help.html') 
    elseif exist('./my_prog_help.txt', 'file') 
    winopen('trip_viewer_help.txt') 
    end 

注意,這是Windows專用。

相關問題