File Exchange Pick of the Week

Our best user submissions

Hyperlink

Sean's pick this week is Hyperlink by Michele Scalseggi.   Have you ever wanted to quickly put a hyperlink at the command line or in the help for a function you're writing? What about a link that when clicked evaluates some MATLAB code? Michele's easy to use Hyperlink command will do this for you. It interprets whether you're targeting a website or MATLAB expression and builds the link so that when displayed at the command line will do what you want. For example, let's put "why" at the command line so that when you click the link it evaluates why(): Alternatively, let's have it take you to MathWorks' website: We could easily pass this into fprintf or disp to make a nice sentence with hyperlinks. Here's a Matrix themed example: Finally, perhaps you want to put a hyperlink in the help of a function you're writing. I'd encourage you to use the clipboard command to directly copy it in.
clipboard('copy',Hyperlink('edit(''example.m'')','Open Example'))
So now you can paste this into the help of your function directly
function y = myfun(x)
% MYFUN takes the sin of x
%
% <a href="matlab:edit('example.m')">Open Example</a>
% 

y = sin(x);
Then asking for help on myfun will show the link:

Comments

Give it a try and let us know what you think here or leave a comment for Michele.

Published with MATLAB® R2016b

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.