{"id":1372,"date":"2016-04-08T08:53:13","date_gmt":"2016-04-08T13:53:13","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/?p=1372"},"modified":"2016-03-23T14:34:42","modified_gmt":"2016-03-23T19:34:42","slug":"pausing-for-a-favorite-feature-of-r2016a","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2016\/04\/08\/pausing-for-a-favorite-feature-of-r2016a\/","title":{"rendered":"Pausing for a Favorite Feature of R2016a"},"content":{"rendered":"<div class=\"content\"><!--introduction--><p>You may end up hearing this from many of the different bloggers at MathWorks. <a href=\"https:\/\/blogs.mathworks.com\/steve\/2016\/03\/23\/pausing-matlab-r2016a\/\">Steve<\/a> and <a href=\"https:\/\/blogs.mathworks.com\/videos\/2016\/03\/18\/new-matlab-feature-in-release-2016a-pause-button\/\">Stuart<\/a> did!  And now for my turn.<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#e17d378c-d824-4fc7-8c21-9399ac945371\">Example Code<\/a><\/li><li><a href=\"#e3f20f84-e605-484d-935f-a5432b134723\">Before You Start<\/a><\/li><li><a href=\"#de05fc03-b700-413c-9491-b5572b0f1524\">Once the Code is Running<\/a><\/li><li><a href=\"#1be29d35-0379-4d44-9407-50308bab34d7\">Continue Executing the Code<\/a><\/li><li><a href=\"#ff8a62f4-ea0f-43d4-ada5-e20bfb831e0e\">Useful?<\/a><\/li><\/ul><\/div><p>Have you ever desparately wished that you could find out what your calculation was up to, but, since it had been running a long time already, you didn't want to interrupt it, especially in case it was close?  I have often wanted this.  And now, on the Editor portion of the toolstrip, you can do this.<\/p><h4>Example Code<a name=\"e17d378c-d824-4fc7-8c21-9399ac945371\"><\/a><\/h4><p>Just to show you what the different states looked like, I have created a horrible piece of code to run.<\/p><pre class=\"codeinput\">type <span class=\"string\">forever<\/span>\r\n<\/pre><pre class=\"codeoutput\">\r\nfunction a = forever\r\nwhile 1\r\n    a = 1+1;\r\nend\r\nend\r\n<\/pre><h4>Before You Start<a name=\"e3f20f84-e605-484d-935f-a5432b134723\"><\/a><\/h4><p>As you can see, it would never stop.  Before I run it, here's what you see with the editor in focus.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2016\/foreverStart.png\" alt=\"\"> <\/p><h4>Once the Code is Running<a name=\"de05fc03-b700-413c-9491-b5572b0f1524\"><\/a><\/h4><p>When the code is executing, you see this, again with the editor still in focus.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2016\/foreverPause.png\" alt=\"\"> <\/p><p>You are given the opportunity to pause the running code.  MATLAB will pop you into the debugger where you can do the usual sleuthing around.  And then...<\/p><h4>Continue Executing the Code<a name=\"1be29d35-0379-4d44-9407-50308bab34d7\"><\/a><\/h4><p>Once you've done what you wanted in the debugger, you can then press <b>Continue<\/b> or <b>Quit Debugging<\/b>.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2016\/foreverContinue.png\" alt=\"\"> <\/p><p>And go happily (I hope) along with your work.<\/p><h4>Useful?<a name=\"ff8a62f4-ea0f-43d4-ada5-e20bfb831e0e\"><\/a><\/h4><p>Do you find this new capability useful?  We'd love to hear if it helps you out <a href=\"https:\/\/blogs.mathworks.com\/loren\/?p=1372#respond\">here<\/a>.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_e6b01e9a4abe492dbd9cd36ac2585b3a() {\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='e6b01e9a4abe492dbd9cd36ac2585b3a ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' e6b01e9a4abe492dbd9cd36ac2585b3a';\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 2016 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_e6b01e9a4abe492dbd9cd36ac2585b3a()\"><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; R2016a<br><\/p><\/div><!--\r\ne6b01e9a4abe492dbd9cd36ac2585b3a ##### SOURCE BEGIN #####\r\n%% Pausing for a Favorite Feature of R2016a\r\n% You may end up hearing this from many of the different bloggers at\r\n% MathWorks.\r\n% <https:\/\/blogs.mathworks.com\/steve\/2016\/03\/23\/pausing-matlab-r2016a\/\r\n% Steve> and\r\n% <https:\/\/blogs.mathworks.com\/videos\/2016\/03\/18\/new-matlab-feature-in-release-2016a-pause-button\/\r\n% Stuart> did!  And now for my turn.\r\n%%\r\n% Have you ever desparately wished that you could find out what your\r\n% calculation was up to, but, since it had been running a long time\r\n% already, you didn't want to interrupt it, especially in case it was\r\n% close?  I have often wanted this.  And now, on the Editor portion of the\r\n% toolstrip, you can do this.\r\n%% Example Code\r\n% Just to show you what the different states looked like, I have created a\r\n% horrible piece of code to run.\r\ntype forever\r\n%% Before You Start\r\n% As you can see, it would never stop.  Before I run it, here's what you\r\n% see with the editor in focus.\r\n%\r\n% <<foreverStart.png>>\r\n%\r\n%% Once the Code is Running\r\n% When the code is executing, you see this, again with the editor still in\r\n% focus.\r\n%\r\n% <<foreverPause.png>>\r\n%\r\n% You are given the opportunity to pause the running code.  MATLAB will pop\r\n% you into the debugger where you can do the usual sleuthing around.  And\r\n% then...\r\n%% Continue Executing the Code\r\n% Once you've done what you wanted in the debugger, you can then press\r\n% *Continue* or *Quit Debugging*.\r\n%\r\n% <<foreverContinue.png>>\r\n%\r\n% And go happily (I hope) along with your work.\r\n%% Useful?\r\n% Do you find this new capability useful?  We'd love to hear if it helps\r\n% you out <https:\/\/blogs.mathworks.com\/loren\/?p=1372#respond here>.\r\n\r\n\r\n##### SOURCE END ##### e6b01e9a4abe492dbd9cd36ac2585b3a\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2016\/foreverStart.png\" onError=\"this.style.display ='none';\" \/><\/div><!--introduction--><p>You may end up hearing this from many of the different bloggers at MathWorks. <a href=\"https:\/\/blogs.mathworks.com\/steve\/2016\/03\/23\/pausing-matlab-r2016a\/\">Steve<\/a> and <a href=\"https:\/\/blogs.mathworks.com\/videos\/2016\/03\/18\/new-matlab-feature-in-release-2016a-pause-button\/\">Stuart<\/a> did!  And now for my turn.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2016\/04\/08\/pausing-for-a-favorite-feature-of-r2016a\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[39,6],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/1372"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/comments?post=1372"}],"version-history":[{"count":3,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/1372\/revisions"}],"predecessor-version":[{"id":1375,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/1372\/revisions\/1375"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=1372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=1372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=1372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}