Linking to a specific (non-function's) documentation page programmatically

≯℡__Kan透↙ 提交于 2019-12-02 08:08:32

问题


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:


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.

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'))


来源:https://stackoverflow.com/questions/36248974/linking-to-a-specific-non-functions-documentation-page-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!