{"id":252,"date":"2010-10-29T15:29:58","date_gmt":"2010-10-29T15:29:58","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/2010\/10\/29\/editor-features-in-r2010b\/"},"modified":"2010-10-27T15:30:23","modified_gmt":"2010-10-27T15:30:23","slug":"editor-features-in-r2010b","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2010\/10\/29\/editor-features-in-r2010b\/","title":{"rendered":"Editor Features in R2010b"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      <p>There are a couple of features available in the editor in R2010b that I take full advantage of.  Variable highlighting is\r\n         one, and comment wrapping is the second.\r\n      <\/p>\r\n   <\/introduction>\r\n   <h3>Contents<\/h3>\r\n   <div>\r\n      <ul>\r\n         <li><a href=\"#1\">Variable Highlighting<\/a><\/li>\r\n         <li><a href=\"#4\">Comment Wrapping<\/a><\/li>\r\n         <li><a href=\"#6\">Comments?<\/a><\/li>\r\n      <\/ul>\r\n   <\/div>\r\n   <h3>Variable Highlighting<a name=\"1\"><\/a><\/h3>\r\n   <p>There are two aspects to variable highlighting that are available in the editor in R2010b.  The first is that if you select\r\n      a variable, all other instances of that variable get highlighted and a summary of the usage appears in the status bar and\r\n      the lines where these appear show up on the information bar on the right-hand side (where code analyzer messages also appear).\r\n   <\/p>\r\n   <p>The other highlights that you can see are for nonlocal variables, i.e., variables shared between a parent function and a function\r\n      nested in it.\r\n   <\/p>\r\n   <p>You can turn these highlights on and off and change the highlight colors in the MATLAB preferences. Mike talks more about\r\n      variable highlighting in <a href=\"https:\/\/blogs.mathworks.com\/community\/2010\/10\/11\/automatic-variable-highlighting\/\">this post<\/a>, as well as showing pictures.\r\n   <\/p>\r\n   <h3>Comment Wrapping<a name=\"4\"><\/a><\/h3>\r\n   <p>Since I produce my blog by writing MATLAB code in the editor, I find myself frequently editing and having some lines very\r\n      long, and some unnecessarily short.  I used to have to select an entire region and rewrap the comments.  Now I only have to\r\n      have my cursor in that region, and with the stroke of Ctrl-J, I get them nicely wrapped.  Jared talks more about this in his\r\n      <a href=\"https:\/\/blogs.mathworks.com\/community\/2010\/10\/04\/r2010b-comment-wrapping-improvements\/\">first post<\/a>.\r\n   <\/p>\r\n   <p>In his <a href=\"https:\/\/blogs.mathworks.com\/community\/2010\/10\/25\/r2010b-comment-wrapping-improvements-continued\/\">second post<\/a>, Jared talks more working with indented code and wrapping associated comments.  In addition, block comments now wrap appropriately\r\n      as well.\r\n   <\/p>\r\n   <h3>Comments?<a name=\"6\"><\/a><\/h3>\r\n   <p>Any <i>comments<\/i> on managing comments in MATLAB code?  Let me know <a href=\"https:\/\/blogs.mathworks.com\/loren\/?p=252#respond\">here<\/a>.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_06ebb8d57b744ec5a0250d87b4366f7b() {\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='06ebb8d57b744ec5a0250d87b4366f7b ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 06ebb8d57b744ec5a0250d87b4366f7b';\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        author = 'Loren Shure';\r\n        copyright = 'Copyright 2010 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 author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\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      \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_06ebb8d57b744ec5a0250d87b4366f7b()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; 7.11<br><\/p>\r\n<\/div>\r\n<!--\r\n06ebb8d57b744ec5a0250d87b4366f7b ##### SOURCE BEGIN #####\r\n%% Editor Features in R2010b\r\n% There are a couple of features available in the editor in R2010b that I\r\n% take full advantage of.  Variable highlighting is one, and comment\r\n% wrapping is the second.\r\n%% Variable Highlighting\r\n% There are two aspects to variable highlighting that are available in the\r\n% editor in R2010b.  The first is that if you select a variable, all other\r\n% instances of that variable get highlighted and a summary of the usage\r\n% appears in the status bar and the lines where these appear show up on the\r\n% information bar on the right-hand side (where code analyzer messages\r\n% also appear).\r\n%%\r\n% The other highlights that you can see are for nonlocal variables, i.e.,\r\n% variables shared between a parent function and a function nested in it.\r\n%%\r\n% You can turn these highlights on and off and change the highlight colors\r\n% in the MATLAB preferences. Mike talks more about variable highlighting in\r\n% <https:\/\/blogs.mathworks.com\/community\/2010\/10\/11\/automatic-variable-highlighting\/\r\n% this post>, as well as showing pictures.\r\n%% Comment Wrapping\r\n% Since I produce my blog by writing MATLAB code in the editor, I find\r\n% myself frequently editing and having some lines very long, and some\r\n% unnecessarily short.  I used to have to select an entire region and\r\n% rewrap the comments.  Now I only have to have my cursor in that region,\r\n% and with the stroke of Ctrl-J, I get them nicely wrapped.  Jared talks\r\n% more about this in his\r\n% <https:\/\/blogs.mathworks.com\/community\/2010\/10\/04\/r2010b-comment-wrapping-improvements\/\r\n% first post>.\r\n%%\r\n% In his <https:\/\/blogs.mathworks.com\/community\/2010\/10\/25\/r2010b-comment-wrapping-improvements-continued\/\r\n% second post>, Jared talks more working with indented code and wrapping\r\n% associated comments.  In addition, block comments now wrap appropriately\r\n% as well.\r\n%% Comments?\r\n% Any _comments_ on managing comments in MATLAB code?  Let me know\r\n% <https:\/\/blogs.mathworks.com\/loren\/?p=252#respond here>.\r\n##### SOURCE END ##### 06ebb8d57b744ec5a0250d87b4366f7b\r\n-->","protected":false},"excerpt":{"rendered":"<p>\r\n   \r\n      There are a couple of features available in the editor in R2010b that I take full advantage of.  Variable highlighting is\r\n         one, and comment wrapping is the second.\r\n   ... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2010\/10\/29\/editor-features-in-r2010b\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[6,13],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/252"}],"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=252"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/252\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}