{"id":10430,"date":"2019-01-18T10:48:39","date_gmt":"2019-01-18T15:48:39","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=10430"},"modified":"2019-01-18T10:48:39","modified_gmt":"2019-01-18T15:48:39","slug":"live-script-gallery-and-run-in-browser","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2019\/01\/18\/live-script-gallery-and-run-in-browser\/","title":{"rendered":"Live Script Gallery and &#8220;Run in Browser&#8221;"},"content":{"rendered":"\r\n<div class=\"content\"><p><a href=\"http:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/869871\">Jiro<\/a>&#8216;s pick this week is the <a href=\"https:\/\/www.mathworks.com\/products\/matlab\/live-script-gallery.html\">Live Script Gallery<\/a>.<\/p><p>I&#8217;m going a bit out-of-model today to highlight a new page that became live recently in MathWorks website. The <a href=\"https:\/\/www.mathworks.com\/products\/matlab\/live-script-gallery.html\">Live Script Gallery<\/a> showcases some <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/what-is-a-live-script-or-function.html\">live script<\/a> examples found on the File Exchange. You can download these live scripts from their File Exchange entries, run them on your MATLAB, on <a href=\"https:\/\/www.mathworks.com\/products\/matlab-online.html\">MATLAB Online<\/a>, or even in the new &#8220;Run this example&#8221; option of the gallery which lets you run the script directly on your browser. No license required!<\/p><p>In this video, I am opening one of the examples (the File Exchange entry is already a <a href=\"https:\/\/blogs.mathworks.com\/pick\/2011\/11\/11\/3d-polar-plotting\/\">Pick<\/a> on its own) in the the browser, running some code, modifying the code, and re-running it. At the end, I&#8217;m also interacting with the graph.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_livescriptgallery\/run_example_in_web.gif\" alt=\"\"> <\/p><p><b>Comments<\/b><\/p><p>Check out all the other examples in the <a href=\"https:\/\/www.mathworks.com\/products\/matlab\/live-script-gallery.html\">gallery<\/a>, and perhaps it&#8217;ll give you ideas on your next script. Let us know what you think <a href=\"http:\/\/blogs.mathworks.com\/pick\/?p=10430#respond\">here<\/a>.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_01df9b4cd64449e2973af55a65d18fdc() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='01df9b4cd64449e2973af55a65d18fdc ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 01df9b4cd64449e2973af55a65d18fdc';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2019 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_01df9b4cd64449e2973af55a65d18fdc()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2018b<br><\/p><p class=\"footer\"><br>\r\n      Published with MATLAB&reg; R2018b<br><\/p><\/div><!--\r\n01df9b4cd64449e2973af55a65d18fdc ##### SOURCE BEGIN #####\r\n%%\r\n% <http:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/869871 Jiro>'s\r\n% pick this week is the\r\n% <https:\/\/www.mathworks.com\/products\/matlab\/live-script-gallery.html Live\r\n% Script Gallery>.\r\n%\r\n% I'm going a bit out-of-model today to highlight a new page that became\r\n% live recently in MathWorks website. The\r\n% <https:\/\/www.mathworks.com\/products\/matlab\/live-script-gallery.html Live\r\n% Script Gallery> showcases some\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/what-is-a-live-script-or-function.html\r\n% live script> examples found on the File Exchange. You can download these\r\n% live scripts from their File Exchange entries, run them on your MATLAB,\r\n% on <https:\/\/www.mathworks.com\/products\/matlab-online.html MATLAB Online>,\r\n% or even in the new \"Run this example\" option of the gallery which lets\r\n% you run the script directly on your browser. No license required!\r\n%\r\n% In this video, I am opening one of the examples (the File Exchange entry\r\n% is already a\r\n% <https:\/\/blogs.mathworks.com\/pick\/2011\/11\/11\/3d-polar-plotting\/ Pick> on\r\n% its own) in the the browser, running some code, modifying the code, and\r\n% re-running it. At the end, I'm also interacting with the graph.\r\n%\r\n% <<run_example_in_web.gif>>\r\n%\r\n% *Comments*\r\n%\r\n% Check out all the other examples in the\r\n% <https:\/\/www.mathworks.com\/products\/matlab\/live-script-gallery.html\r\n% gallery>, and perhaps it'll give you ideas on your next script. Let us\r\n% know what you think <http:\/\/blogs.mathworks.com\/pick\/?p=10430#respond\r\n% here>.\r\n\r\n##### SOURCE END ##### 01df9b4cd64449e2973af55a65d18fdc\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_livescriptgallery\/run_example_in_web.gif\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\nJiro&#8216;s pick this week is the Live Script Gallery.I&#8217;m going a bit out-of-model today to highlight a new page that became live recently in MathWorks website. The Live Script Gallery&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2019\/01\/18\/live-script-gallery-and-run-in-browser\/\">read more >><\/a><\/p>","protected":false},"author":35,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/10430"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=10430"}],"version-history":[{"count":2,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/10430\/revisions"}],"predecessor-version":[{"id":10434,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/10430\/revisions\/10434"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=10430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=10430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=10430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}