Linking to a specific (non-function's) documen

2019-02-28 14:49发布

As part of writing some documentation for my code, I would like to include a runnable command which would show the user some specific documentation page I have in mind, from MATLAB's docs.

This is easy to do when the desired page belongs to a function or a tool, e.g.

 doc cftool

Or if there can be ambiguity, one could also specify the folder/package name:

 doc curvefit\cftool

(Note: It was my understanding for the documentation of doc that this should be doable with . but that doesn't seem to work. After digging a bit in doc.m I saw that using / or \ does the trick...)

However, I'm trying to link to a "package-level" documentation page, e.g. Evaluating Goodness of Fit whose "help path" is curvefit/evaluating-goodness-of-fit, but the following command does not work:

doc curvefit/evaluating-goodness-of-fit

Question: How can I successfully open a specific, non-(function|class)-related documentation page programmatically in MATLAB?

P.S. I'd rather avoid hard-coding the path to the .html of the help page within MATLAB's folders.

1条回答
爷的心禁止访问
2楼-- · 2019-02-28 15:52

Open the page in question in the documentation browser, right-click anywhere on the page and choose "Get Page Address". This opens a dialog with the location of the doc page both locally and a URL to the online webpage.

doc

You can see how the local command given is just a direct call to the HTML file to be displayed in the embedded help browser.

So take queue from MathWorks and just do the same thing by programmatically calling this from your program:

>> web(fullfile(docroot, 'curvefit/evaluating-goodness-of-fit.html'))
查看更多
登录 后发表回答