Directly open custom documentation
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Faker Mayfield
el 23 de Dic. de 2019
Comentada: per isakson
el 25 de Dic. de 2019
I've created custom documentation that when typing "doc" is viewable by following the trail under Supplemental Software. However, I would prefer to access the custom documentation directly without having to use "doc" and then follow down the Supplemental Software trail. Is there any way to directly open custom documentation with a single command?
2 comentarios
Respuesta aceptada
per isakson
el 23 de Dic. de 2019
Editada: per isakson
el 25 de Dic. de 2019
It hasn't bothered me, but
doc toolbox_name
If the name is unique enough it produces a short list of search results. In my case the page of interest is the top one. One extra click needed.
Next a one-liner, which opens the documentation home page in the help browser (using a bit of magic)
web('documentation_home_page.html','-new')
However, this must be hidden from the user in one way or another and still be easy to use. A favorite doesn't really provide much of an improvement.
/R2018b
In response to comment
The magic works better for me
>> web('m2umlToolbox.html', '-new')
produces this
The function, builtin, doesn't work with doc, but How do I invoke a shadowed core MATLAB function does. Now
doc m2uml
opens the page shown above and
doc plot
opens the expected Matlab page.
Listing of doc
function doc( varargin )
persistent mdc
if isempty( mdc )
wch = which('doc.m','-all');
isf = contains( wch, matlabroot ); % there should only be one
wch = wch{isf};
pth = fileparts( wch );
old = cd( pth );
mdc = str2func('doc'); % create a function-handle
cd( old );
end
switch varargin{1}
case 'm2uml'
web('m2umlToolbox.html', '-new')
otherwise
mdc( varargin{:} )
end
end
Files and search path
I've used the word "magic" a couple of times to indicate that I don't understand how it works or what's required to make it work. I've stumbled upon one way that hasn't failed so far.
My starting point was the blog, Best Practices – Adapt, then Adopt! Posted by Andy Campbell, January 13, 2017 , which predates my R2018b. This blog "presents" the FEX-submission, Toolbox Tools 1.1 by Amy Koh, [Staff], A toolbox for developing custom toolboxes in MATLAB. This toolbox was "Created with R2017b" and is "Compatible with any release".
Important files, i.e files which I beleive are required
- ...\tbx\info.xml where tbx is on the search path. Used by Matlab to find the documentation (i.e. create some kind of database entry)
- ...\tbx\doc\helptoc.xml where doc is on the search path.
- ...\tbx\doc\*.html all the html-files
where info.xml (there must be exactly one info.xml with the name-tag-value m2uml)
<productinfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="optional">
<?xml-stylesheet type="text/xsl"href="optional"?>
<!-- Copyright 2019 The MathWorks Ltd. -->
<matlabrelease>R2018b</matlabrelease>
<name>m2uml</name>
<type>toolbox</type>
<icon></icon>
<help_location>doc</help_location>
</productinfo>
and helptoc.xml
<?xml version='1.0' encoding="utf-8"?>
<toc version="2.0">
<tocitem target="m2umlToolbox.html"> m2uml Toolbox
<tocitem target="Overview.html"> Overview </tocitem>
<tocitem target="Installation.html"> Installation </tocitem>
<tocitem target="Limitations.html"> Limitations </tocitem>
<tocitem target="IntroductoryExamples.html"> Introductory examples </tocitem>
<tocitem target="Options.html"> Options </tocitem>
<tocitem target="UserInterface.html"> User interface </tocitem>
<tocitem target="Layout.html"> Layout </tocitem>
<tocitem target="Relationships.html"> Relationships </tocitem>
<tocitem target="ImageRow.html"> ImageRow </tocitem>
<tocitem target="Examples.html"> Examples </tocitem>
<tocitem target="TechnicalDocumentation.html"> Technical documentation </tocitem>
</tocitem>
</toc>
It seems, it doesn't matter which html-file (in the folder, doc) I open
>> web('ImageRow.html','-new')
works as I have come to expect (i.e. navigation panel to the left).
4 comentarios
per isakson
el 25 de Dic. de 2019
"Are you pointing to an HTML file within a specific directory?" Yes, I try to explain in my answer.
Más respuestas (1)
Sean de Wolski
el 23 de Dic. de 2019
web(fullfile(docroot, '3ptoolbox/toolbox_name/doc/Index.html'))
You can get this by navigating to your custom doc page's Index, right clicking and "Get Page Address". This provides the nav panel on the right-hand side.
4 comentarios
Sean de Wolski
el 24 de Dic. de 2019
Just confirmed it works in 19a as well so was apparently added then.
Ver también
Categorías
Más información sobre MATLAB Report Generator en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!