Directly open custom documentation

16 ビュー (過去 30 日間)
Faker Mayfield
Faker Mayfield 2019 年 12 月 23 日
コメント済み: per isakson 2019 年 12 月 25 日
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 件のコメント
per isakson
per isakson 2019 年 12 月 23 日
What about?
doc name
Faker Mayfield
Faker Mayfield 2019 年 12 月 23 日
Performing "doc name" will just search all documentation and not directly open up my custom documentation.
As noted in the "doc" help reference:
"To access third-party or custom documentation, open the Help browser and navigate to the documentation home page. Then, at the bottom of the page, click Supplemental Software."
I'm attempting to avoid this step of clicking Supplemental Software, if possible.

サインインしてコメントする。

採用された回答

per isakson
per isakson 2019 年 12 月 23 日
編集済み: per isakson 2019 年 12 月 25 日
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 件のコメント
Faker Mayfield
Faker Mayfield 2019 年 12 月 24 日
Appreciate integrating the use of doc as best as possible.
The web answers seems acceptable, but for me it opens a barebones HTML doc and not one with the navigation on the side. Are you pointing to an HTML file within a specific directory? I'm able to do as Sean suggested below ( navigating to your custom doc page's Index, right clicking and "Get Page Address" ) and I do get an address with the panel. I'm curious as to how you did it with just an HTML file.
per isakson
per isakson 2019 年 12 月 25 日
"Are you pointing to an HTML file within a specific directory?" Yes, I try to explain in my answer.

サインインしてコメントする。

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2019 年 12 月 23 日
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 件のコメント
Faker Mayfield
Faker Mayfield 2019 年 12 月 24 日
So, is there no similar solution to this in sub-2019b versions? Appreciate the support from the both of you!
Sean de Wolski
Sean de Wolski 2019 年 12 月 24 日
Just confirmed it works in 19a as well so was apparently added then.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by