以编程方式链接到特定(非功能)文档页面 [英] Linking to a specific (non-function's) documentation page programmatically

查看:152
本文介绍了以编程方式链接到特定(非功能)文档页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为编写我的代码的一些文档的一部分,我想包括一个runnable命令,它将向用户显示我从MATLAB的文档中考虑的一些特定文档页面。



当所需页面属于某个功能或工具时,这很容易,例如

  doc cftool 

或者如果可能存在歧义,还可以指定文件夹/包名称:

  doc curvefit\cftool 

注意:这是我对



你可以看到给出的本地命令只是一个直接调用要在嵌入式帮助浏览器中显示的HTML文件。



所以从MathWorks中排队,只需从程序中以编程方式调用这个方法:

 >> web(fullfile(docroot,'curvefit / evaluate-goodness-of-fit.html'))


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.

解决方案

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

这篇关于以编程方式链接到特定(非功能)文档页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆