Comments on: Printing hyperlinks to the Command Window https://blogs.mathworks.com/community/2007/07/09/printing-hyperlinks-to-the-command-window/?s_tid=feedtopost News from the intersection of MATLAB, Community, and the web. Mon, 11 Jul 2011 14:17:35 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Mike https://blogs.mathworks.com/community/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7936 Mon, 11 Jul 2011 14:17:35 +0000 https://blogs.mathworks.com/desktop/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7936 Chris,

You just need to put the interesting text in the link, using (s/f)printf or using array concatenation in disp.

E.g.

for i=1:3
    fprintf('This is a link #%i <a href="http://www.google.com/#q=number%i" rel="nofollow">Google for %i</a>.\n',i,i,i)
end
]]>
By: Chris https://blogs.mathworks.com/community/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7931 Fri, 08 Jul 2011 16:17:46 +0000 https://blogs.mathworks.com/desktop/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7931 I am trying to use the matlabcolon methodology described above to display hyperlinks to the command window, where my HYPERLINK_TEXT is not constant string, but rather changes dynamically in a FOR loop. This is because I want to print out hyperlinks for a number of data files dynamically. So far I have not been able to do this. Is this possible?

]]>
By: Daniel Armyr https://blogs.mathworks.com/community/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7835 Mon, 20 Jun 2011 12:28:06 +0000 https://blogs.mathworks.com/desktop/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7835 Oh.
Just found the answer in a much newer post: Replacing the above line with

disp('You should <a href="matlab:matlab.desktop.editor.openAndGoToLine(which(''why.m''),27)">open my file</a>!')
]]>
By: Daniel Armyr https://blogs.mathworks.com/community/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7834 Mon, 20 Jun 2011 09:33:18 +0000 https://blogs.mathworks.com/desktop/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7834 Hi.
I found this blog post a few months ago and started using this trick in several functions where one might want to quickly find the piece of code that printed the output.

Now that I upgraded to Matlab 2011a, the code does not work any more.

This code:

disp('You should &lta href="matlab: opentoline(which(''why.m''),27)">open my file&lt/a>!')

Gives me the following message:
“File c:\…\which(‘why.m’) does not exist. […]”

Indicating that the contents of the first parentesis are taken as a literal string and are not evaluated as Matlab code. Does anyone have a workaround, because the hyperlink thing was really useful.

]]>
By: AdrianC https://blogs.mathworks.com/community/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7628 Mon, 28 Feb 2011 22:35:01 +0000 https://blogs.mathworks.com/desktop/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7628 Hi,
After I create a hyperlink, I want to be able to click on the link automatically so I dont have to do it manually. The link will be to an image from an IP camera, and ideally I would like to save the resulting image. My aim is to write software that records jpegs from an IP camera at X frames per second. Has anyone done something like this?
Thanks,
Adrian

]]>
By: Nic https://blogs.mathworks.com/community/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7493 Tue, 14 Dec 2010 17:01:51 +0000 https://blogs.mathworks.com/desktop/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7493 Thanks jiro – so many bits and pieces to learn!

]]>
By: jiro https://blogs.mathworks.com/community/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7492 Tue, 14 Dec 2010 12:36:11 +0000 https://blogs.mathworks.com/desktop/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7492 @Nic,

You should be able to do this:

disp('<a href="matlab:winopen(''C:\'')">Go to data directory</a>')

]]>
By: Nic https://blogs.mathworks.com/community/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7491 Tue, 14 Dec 2010 12:13:00 +0000 https://blogs.mathworks.com/desktop/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7491 Apologies for this – I have found a solution but the issue was with my own function.

In case someone is interested – here is a piece of code that creates a hyperlink to open windows explorer to a particular folder, in this case the c drive:

disp(‘<a href=”matlab:dos(”explorer.exe /e, c:\, &”)”>Go to data directory</a>’)

note: including ‘&’ in the dos command input, returns to matlab immediately and the busy state is not an issue.

]]>
By: Nic https://blogs.mathworks.com/community/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7490 Tue, 14 Dec 2010 11:57:57 +0000 https://blogs.mathworks.com/desktop/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7490 One more time…

disp(‘<a href=”matlab:winExplorer(”c:\”)”>Go to directory</a>’)

]]>
By: Nic https://blogs.mathworks.com/community/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7489 Tue, 14 Dec 2010 11:39:13 +0000 https://blogs.mathworks.com/desktop/2007/07/09/printing-hyperlinks-to-the-command-window/#comment-7489 Might be easier if you can see the code:

disp(‘Go to data directory‘)

]]>