-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathnstatOpenHelpPage.m
More file actions
52 lines (44 loc) · 1.38 KB
/
nstatOpenHelpPage.m
File metadata and controls
52 lines (44 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function pagePath = nstatOpenHelpPage(pageName, openBrowser)
% nstatOpenHelpPage Open an nSTAT help page in the system browser.
%
% nstatOpenHelpPage('Examples')
% nstatOpenHelpPage('SignalObjExamples.html')
% pagePath = nstatOpenHelpPage('Examples', false)
%
% The .html extension is appended automatically when omitted, so both
% nstatOpenHelpPage('Examples') and nstatOpenHelpPage('Examples.html')
% are equivalent.
%
% This helper resolves the nSTAT helpfiles folder path so that links
% work regardless of the current working directory.
%
% See also nSTAT_Install, Contents
if nargin < 1 || isempty(pageName)
error('nstatOpenHelpPage:MissingPage', ...
'Provide a help page name such as ''Examples'' or ''Examples.html''.');
end
if nargin < 2
openBrowser = true;
end
% Append .html if no extension provided
[~, ~, ext] = fileparts(pageName);
if isempty(ext)
pageName = [pageName '.html'];
end
rootDir = fileparts(which('nSTAT_Install'));
if isempty(rootDir)
rootDir = fileparts(which('SignalObj'));
end
if isempty(rootDir)
error('nstatOpenHelpPage:RootNotFound', ...
'Could not resolve the nSTAT installation path.');
end
pagePath = fullfile(rootDir, 'helpfiles', pageName);
if ~isfile(pagePath)
error('nstatOpenHelpPage:PageMissing', ...
'Help page not found: %s', pagePath);
end
if openBrowser
web(pagePath, '-browser');
end
end