{"id":70,"date":"2007-07-09T07:28:21","date_gmt":"2007-07-09T12:28:21","guid":{"rendered":"https:\/\/blogs.mathworks.com\/desktop\/2007\/07\/09\/printing-hyperlinks-to-the-command-window\/"},"modified":"2007-08-15T14:35:23","modified_gmt":"2007-08-15T19:35:23","slug":"printing-hyperlinks-to-the-command-window","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/community\/2007\/07\/09\/printing-hyperlinks-to-the-command-window\/","title":{"rendered":"Printing hyperlinks to the Command Window"},"content":{"rendered":"<p>I quite often get asked how to print out hyperlinks to the Command Window.  It&#8217;s really easy!  The Command Window accepts <em>&lt;a href <\/em>tags that contain valid links. Valid links contain <em>http:\/\/ <\/em>or <em>matlab:<\/em>.  The Command Window treats any text after the <em>matlab:<\/em> syntax, inside the quote marks, as executable M-code.  <\/p>\n<p>Here are some examples of hyperlinks in the Command Window.<\/p>\n<p><strong>Hyperlink to a web page<\/strong><\/p>\n<p><code>disp('This is a link to &lt;a href=\"http:\/\/www.google.com\"&gt;Google&lt;\/a&gt;.')<\/code><\/p>\n<p><strong>Hyperlink to M-code<\/strong><\/p>\n<p><code>disp('You should &lt;a href=\"matlab: plot(magic(10)), disp(''I plotted some stuff'')\"&gt;my code&lt;\/a&gt;!')<\/code><\/p>\n<p>I used the <em>disp<\/em> command, but you could also use the <em>fprintf<\/em> command to achieve the same effect.<\/p>\n<p>To open an m-file from the Command Window, disp a matlab: link that uses the function <em>opentoline<\/em>:<\/p>\n<p><code> disp('You should &lt;a href=\"matlab: opentoline(which(''why.m''),27)\"&gt;open my file&lt;\/a&gt;!')<\/code><\/p>\n<p><a href=\"\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/cwhyperlinks.jpg\"\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/cwhyperlinks_sm.jpg\"\/><\/a><\/p>\n<p>These lines of code can be placed in any M-file or in any shortcut on the Desktop toolbar.<\/p>\n<p>The Command Window is not an HTML renderer, so it won&#8217;t interpret other types of html tags &#8211; just the <em>&lt;a href <\/em> tag.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I quite often get asked how to print out hyperlinks to the Command Window.  It&#8217;s really easy!  The Command Window accepts &lt;a href tags that contain valid links. Valid links contain http:\/\/&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/community\/2007\/07\/09\/printing-hyperlinks-to-the-command-window\/\">read more >><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/70"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/comments?post=70"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/70\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/media?parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/categories?post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/tags?post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}