{"id":4710,"date":"2013-07-19T09:00:42","date_gmt":"2013-07-19T13:00:42","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=4710"},"modified":"2013-07-19T12:31:37","modified_gmt":"2013-07-19T16:31:37","slug":"clear-everything","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2013\/07\/19\/clear-everything\/","title":{"rendered":"Clear Everything!"},"content":{"rendered":"\r\n\r\n<div class=\"content\"><p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/15007\">Jiro<\/a>'s picks this week are <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/42559-ccc\"><tt>ccc<\/tt><\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/225623\">Chad Greene<\/a> and <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/37058-clr-==-clear-all--close-all--clc-\"><tt>clr<\/tt><\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/219425\">Brenden Epps<\/a><\/p><p>Yes, this week's picks are these 3 lines of code:<\/p><pre class=\"language-matlab\">clear <span class=\"string\">all<\/span>\r\nclose <span class=\"string\">all<\/span>\r\nclc\r\n<\/pre><p>Is this a joke?! No, not really.<\/p><p>In my day-to-day job as an application engineer, I show how MATLAB can be used to solve people's problems. When I'm in front of customers, I do demo after demo, switching context left and right. I need a quick way to reset everything so that I can show the next thing they need to see. I need to run the three commands above frequently during any single customer engagement.<\/p><p><tt>ccc<\/tt> and <tt>clr<\/tt> both accomplish this with a short, single command. It seems very trivial, but it's probably one of the most used commands in my job. I also use the toolstrip and shortcuts often, so I have a shortcut for <tt>ccc<\/tt>.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_cleareverything\/potw_ccc_shortcut_image.png\" alt=\"\"> <\/p><p>The code behind it is<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_cleareverything\/potw_ccc_shortcut_code.png\" alt=\"\"> <\/p><p>Note that I actually use \"close all force\" to close any hidden figures.<\/p><p>By the way, there's an interesting discussion about the use of \"clear all\" in the <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/42559-ccc#comments\">comments<\/a> section. Personally, I think it's okay as long as you know what it does, and in my case it makes sense for my day-to-day work.<\/p><p><b>Comments<\/b><\/p><p><a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=4710#respond\">Tell us<\/a> about your simple shortcut commands you created to make your life just a little easier. Also, if you do have a command or a shortcut for clearing everything, what do you call it? My colleagues Sean calls it <tt>cll<\/tt> and Brett calls his <tt>purge<\/tt>. Feel free to leave a comment for <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/42559-ccc#comments\">Chad<\/a> or <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/37058-clr-==-clear-all--close-all--clc-#comments\">Brenden<\/a> as well.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_9955df495b6247f89a9d1fc36af5ea1c() {\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='9955df495b6247f89a9d1fc36af5ea1c ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 9955df495b6247f89a9d1fc36af5ea1c';\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 2013 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_9955df495b6247f89a9d1fc36af5ea1c()\"><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; R2013a<br><\/p><p class=\"footer\"><br>\r\n      Published with MATLAB&reg; R2013a<br><\/p><\/div><!--\r\n9955df495b6247f89a9d1fc36af5ea1c ##### SOURCE BEGIN #####\r\n%%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/15007\r\n% Jiro>'s picks this week are\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/42559-ccc |ccc|> by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/225623 Chad\r\n% Greene> and <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/37058-clr-==-clear-all--close-all--clc-\r\n% |clr|> by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/219425\r\n% Brenden Epps>\r\n%\r\n% Yes, this week's picks are these 3 lines of code:\r\n%\r\n%   clear all\r\n%   close all\r\n%   clc\r\n%\r\n% Is this a joke?! No, not really.\r\n%\r\n% In my day-to-day job as an application engineer, I show how MATLAB can be\r\n% used to solve people's problems. When I'm in front of customers, I do\r\n% demo after demo, switching context left and right. I need a quick way to\r\n% reset everything so that I can show the next thing they need to see. I\r\n% need to run the three commands above frequently during any single\r\n% customer engagement.\r\n%\r\n% |ccc| and |clr| both accomplish this with a short, single command. It\r\n% seems very trivial, but it's probably one of the most used commands in my\r\n% job. I also use the toolstrip and shortcuts often, so I have a shortcut\r\n% for |ccc|.\r\n%\r\n% <<potw_ccc_shortcut_image.png>>\r\n%\r\n% The code behind it is\r\n%\r\n% <<potw_ccc_shortcut_code.png>>\r\n%\r\n% Note that I actually use \"close all force\" to close any hidden figures.\r\n% \r\n% By the way, there's an interesting discussion about the use of \"clear\r\n% all\" in the\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/42559-ccc#comments\r\n% comments> section. Personally, I think it's okay as long as you know what\r\n% it does, and in my case it makes sense for my day-to-day work.\r\n% \r\n% *Comments*\r\n%\r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=4710#respond Tell us> about your\r\n% simple shortcut commands you created to make your life just a little\r\n% easier. Also, if you do have a command or a shortcut for clearing\r\n% everything, what do you call it? My colleagues Sean calls it |cll| and\r\n% Brett calls his |purge|. Feel free to leave a comment for\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/42559-ccc#comments Chad>\r\n% or <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/37058-clr-==-clear-all--close-all--clc-#comments\r\n% Brenden> as well.\r\n\r\n##### SOURCE END ##### 9955df495b6247f89a9d1fc36af5ea1c\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_cleareverything\/potw_ccc_shortcut_image.png\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\n\r\nJiro's picks this week are ccc by Chad Greene and clr by Brenden EppsYes, this week's picks are these 3 lines of code:clear all\r\nclose all\r\nclc\r\nIs this a joke?! No, not really.In my day-to-day... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2013\/07\/19\/clear-everything\/\">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\/4710"}],"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=4710"}],"version-history":[{"count":6,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/4710\/revisions"}],"predecessor-version":[{"id":4736,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/4710\/revisions\/4736"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=4710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=4710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=4710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}