MATLAB: How to display a hyperlink in the help text of the function such that clicking the link opens a PDF-file and jumps to a specific page

dispdisplayMATLAB

I would like to know how to display a hyperlink in the help text of my function such that clicking the link opens a PDF-file and jumps to a specific page.

Best Answer

If you are using MATLAB 7.9 (R2009b) or a later release, you may use the following function template to create the required hyperlink:
function b = myfun(a)
% <a href="91661v00.pdf#page=2">Page 2</a>
b = a * 2;
end
>> help myfun
If you are using MATLAB 7.8 (R2009a) or an older release, you may use the following function template to create the required hyperlink:
function b = myfun(a)
% <a href="matlab: temp = pwd; cd('C:\Program Files\Adobe\Reader 9.0\Reader'); dos(['AcroRd32.exe /A ' char(34) 'page=2' char(34) ' C:\work\matfile_format.pdf &']); cd(temp)">Local PDF Page 2</a>
b = a * 2;
end
>> help myfun
In the above template:
- Adobe Reader 9.0 has been used explicitly by navigating into its installation folder to open the PDF-file.
- Variable "temp" has been used to change the folder back to the working folder.
- ASCII code for double quote ("), char(34) has been used since some special characters may not be interpreted correctly as per the documentation of MATLABCOLON (matlab:).
<http://www.mathworks.com/access/helpdesk/help/techdoc/ref/matlabcolon.html>