2 %
function htdoc(topic)
3 % opens mtoc++ documentation in a browser
5 % Opens documentation generated by mtoc++ and
doxygen in a browser. The
6 % directory where the HTML documentation is installed must be geiven by the
7 %
'DOXYGEN_DIR' environment variable. This can be set with
9 % setenv(
'DOXYGEN_DIR',
'/path/to/doxygen/docu');
11 % in the
'startup.m' file, e.g.
14 % topic: a
string or an
object describing
for which the documentation
15 % site shall be opened.
17 doxy_dir = getenv(
'DOXYGEN_DIR');
18 if isempty(doxy_dir) || ~exist(fullfile(doxy_dir,
'index.html'),
'file')
19 error('Environment variable DOXYGEN_DIR needs to be set to a valid documentation directory!');
23 classname = class(topic);
25 toks = get_tokens(topic);
26 classname = get_max_token(toks);
29 [st, headertag] = system(['sed -ne ''s/^.*<\([^>]*\)>File List.*$/\1/p'' ', fullfile(getenv('DOXYGEN_DIR'), 'files.html')]);
30 headertag = ['<', headertag(1:end-1), '>'];
32 [st, res]=system(['grep -l ''', headertag, classname, ' '' ', fullfile(getenv('DOXYGEN_DIR'), '*'), ' | head -1' ]);
34 funcname = regexprep(which(classname), '\\.m$', '');
35 funcname = strrep(funcname, [rbmatlabhome, filesep], '');
36 [st, res]=system(['grep -l ''', headertag, funcname, ' '' ', fullfile(getenv('DOXYGEN_DIR'), '*'), ' | head -1' ]);
39 web(fullfile(getenv('DOXYGEN_DIR'), 'index.html'), '-browser');
40 disp(['Could not find any entry for
object ', classname, '.']);
46 function toks = get_tokens(topic)
47 % function toks = get_tokens(topic)
48 % extracts possible tokens to search for in the documentation directory
49 toks = textscan(topic, '%s', 'Delimiter', './');
52 function mtok = get_max_token(toks)
53 %
function mtok = get_max_token(toks)
54 % returns the token of maximum possible length.
57 for i= length(toks):-1:2
58 mtok = [mtok_temp, sprintf(
'.%s', toks{2:i})];
59 if ~isempty(which(mtok))
function htdoc(topic)
opens mtoc++ documentation in a browser
function rv = doxygen(param1, param2)
Here comes a short description text.