1 |
function opnmldoc(topic) |
---|
2 |
%OPNMLDOC Display OPNML/MATLAB5 HTML documentation in Web browser. |
---|
3 |
% |
---|
4 |
% OPNMLDOC, by itself, launches the Help Desk. |
---|
5 |
% |
---|
6 |
% OPNMLDOC FUNCTION displays the HTML documentation for the MATLAB |
---|
7 |
% function FUNCTION. If FUNCTION is overloaded, doc |
---|
8 |
% lists the overloaded functions in the MATLAB command |
---|
9 |
% window. |
---|
10 |
%% |
---|
11 |
% Examples: |
---|
12 |
% opnmldoc lcontour |
---|
13 |
% This is an OPNML hack of the MATLAB/doc command. |
---|
14 |
|
---|
15 |
% Copyright (c) 1984-98 by The MathWorks, Inc. |
---|
16 |
% $Revision: 5.33 $ $Date: 1997/11/21 23:31:41 $ |
---|
17 |
|
---|
18 |
% Get root directory of OPNML Help |
---|
19 |
global OPNML |
---|
20 |
help_path = [OPNML '/html/']; |
---|
21 |
|
---|
22 |
% Show error if help docs not found |
---|
23 |
if (isempty(help_path)) |
---|
24 |
error('Help_path in OPNMLDOC not defined.') |
---|
25 |
end |
---|
26 |
|
---|
27 |
% Case no topic specified. |
---|
28 |
if (nargin == 0) |
---|
29 |
html_file = fullfile(help_path,'index.html'); |
---|
30 |
if (exist(html_file) ~= 2) |
---|
31 |
error('Could not locate OPNML html pages.'); |
---|
32 |
end |
---|
33 |
display_file(html_file); |
---|
34 |
return |
---|
35 |
end |
---|
36 |
|
---|
37 |
|
---|
38 |
topic_file = [topic '.html']; |
---|
39 |
html_file = fullfile(help_path,topic_file); |
---|
40 |
display_file(html_file); |
---|
41 |
|
---|
42 |
function display_file(html_file) |
---|
43 |
% Construct URL |
---|
44 |
if (strncmp(computer,'MAC',3)) |
---|
45 |
html_file = ['file:///' strrep(html_file,filesep,'/')]; |
---|
46 |
end |
---|
47 |
|
---|
48 |
% Load the correct HTML file into the browser. |
---|
49 |
stat = web(html_file); |
---|
50 |
if (stat==2) |
---|
51 |
error(['Could not launch Web browser. Please make sure that' sprintf('\n') ... |
---|
52 |
'you have enough free memory to launch the browser.']); |
---|
53 |
elseif (stat) |
---|
54 |
error(['Could not load HTML file into Web browser. Please make sure that' sprintf('\n') ... |
---|
55 |
'you have a Web browser properly installed on your system.']); |
---|
56 |
end |
---|
57 |
|
---|
58 |
|
---|
59 |
|
---|