为已部署的MATLAB应用程序添加帮助

时间:2015-12-17 16:30:42

标签: matlab matlab-deployment matlab-compiler

我正在创建一个带有GUI的已编译MATLAB应用程序,使用GUIDE创建。我想在我的应用程序中标记为“帮助”的按钮,打开一个合适的文档。我目前在帮助按钮后面有这个代码:

  % --- 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。

2 个答案:

答案 0 :(得分:0)

而不是使用:

!start trip_viewer_help.html\trip_viewer_help.html &

尝试使用:

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

答案 1 :(得分: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特定的。