{"id":210,"date":"2008-04-28T06:11:52","date_gmt":"2008-04-28T11:11:52","guid":{"rendered":"https:\/\/blogs.mathworks.com\/desktop\/2008\/04\/28\/code-folding-update-in-r2008a\/"},"modified":"2008-05-02T07:54:59","modified_gmt":"2008-05-02T12:54:59","slug":"code-folding-update-in-r2008a","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/community\/2008\/04\/28\/code-folding-update-in-r2008a\/","title":{"rendered":"Code Folding Update in R2008a"},"content":{"rendered":"<p>We heard your requests, and have added <b>12<\/b> more foldable constructs,  including full support for the new <a href=\"https:\/\/www.mathworks.com\/access\/helpdesk\/help\/techdoc\/index.html?\/access\/helpdesk\/help\/techdoc\/matlab_oop\/ug_intropage.html\">MATLAB class system<\/a>. We introduced code folding back in R2007b (check out the blog entry on it <a href=\"https:\/\/blogs.mathworks.com\/community\/2007\/11\/26\/giving-your-code-some-privacy\/\">here<\/a>), and quickly heard that folding only functions and function help was not enough. This is a great example of how your feedback really can affect things.<\/p>\n<p>All these new foldable constructs can really help to hide detail that you may not always need to see (possibly the internals of a <tt>switch<\/tt>\/<tt>case<\/tt> block). This is especially useful if your working on two non-contiguous areas in a file. Normally, this would require lots of scrolling, but with code folding, you can just collapse all the constructs between the two areas (you could also use <a href=\"https:\/\/www.mathworks.com\/access\/helpdesk\/help\/techdoc\/index.html?\/access\/helpdesk\/help\/techdoc\/matlab_env\/f2-58922.html&#038;https:\/\/www.mathworks.com\/access\/helpdesk\/help\/techdoc\/matlab_env\/f2-58922.html#bq4goxb-1\">split screen<\/a>, but I prefer the folding technique).<\/p>\n<p>Here&#8217;s a look at <tt>edit.m<\/tt>, the same <a href=\"https:\/\/blogs.mathworks.com\/images\/desktop\/foldededit.PNG\">file Christina showed<\/a> back in November 2007, only now there are a lot more foldable regions:<\/p>\n<div align=\"center\">\n<a href=\"https:\/\/blogs.mathworks.com\/images\/desktop\/ken_orr_code_folding_r2008a\/code_folding_edit.jpg\"><img decoding=\"async\" border=\"0\" align=\"center\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/ken_orr_code_folding_r2008a\/code_folding_edit_small.jpg\" alt=\"Code folding preferences\"\/><\/a>\n<\/div>\n<p>And the new code folding preferences page:<\/p>\n<div align=\"center\">\n<a href=\"https:\/\/blogs.mathworks.com\/images\/desktop\/ken_orr_code_folding_r2008a\/code_folding_prefs.jpg\"><img decoding=\"async\" border=\"0\" align=\"center\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/ken_orr_code_folding_r2008a\/code_folding_prefs_small.jpg\" alt=\"Code folding preferences\"\/><\/a>\n<\/div>\n<p>Just as with the original two foldable constructs, you can choose which constructs you&#8217;d like to be folded by default. So if you want <tt>switch<\/tt>\/<tt>case<\/tt> blocks to be folded whenever you open a file, select <b>Fold Initially<\/b> next to <b>Switch\/case blocks<\/b> in the <b>Editor\/Debugger -> Code Folding<\/b> preferences pane. <\/p>\n<p>Also note that once you&#8217;ve opened a a file and tweaked what&#8217;s folded and what&#8217;s expanded, the MATLAB Editor will remember the fold state of that file even after you&#8217;ve closed it. So the next time you open your file, everything will be just as you left it.<\/p>\n<p>If there are things you think should be foldable, that we&#8217;re not folding, leave us a comment <a href=\"https:\/\/blogs.mathworks.com\/community\/?p=210#respond\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We heard your requests, and have added 12 more foldable constructs,  including full support for the new MATLAB class system. We introduced code folding back in R2007b (check out the blog entry on it&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/community\/2008\/04\/28\/code-folding-update-in-r2008a\/\">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":[9,6],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/210"}],"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=210"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/210\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/media?parent=210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/categories?post=210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/tags?post=210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}