{"id":8559,"date":"2017-05-05T09:00:43","date_gmt":"2017-05-05T13:00:43","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=8559"},"modified":"2017-05-04T05:26:59","modified_gmt":"2017-05-04T09:26:59","slug":"navigating-made-easy","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2017\/05\/05\/navigating-made-easy\/","title":{"rendered":"Navigating Made Easy"},"content":{"rendered":"\r\n<div class=\"content\"><p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/869871\">Jiro<\/a>&#8216;s pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/62683-easybrowser\">easyBrowser<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/8426716\">Michele Scalseggi<\/a>.<\/p><p>When I work on a large project, I usually have files scattered across multiple directories with many files open at once in the Editor. Being able to quickly navigate through the files and directories becomes really important from an efficiency point of view. Some of the Editor features I can&#8217;t live without are<\/p><div><ul><li>&#8220;Open file&#8221; context menu. I usually use the shortcut &#8220;Control-D&#8221;.<\/li><\/ul><\/div><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_easyBrowser\/potw_open_file_menu.png\" alt=\"\"> <\/p><div><ul><li>&#8220;Change directory&#8221; context menu from the file list tab.<\/li><\/ul><\/div><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_easyBrowser\/potw_change_directory_menu.png\" alt=\"\"> <\/p><div><ul><li>Auto-highlighting of variable names. I then use Alt-&lt;arrow key&gt; to jump to the other occurrences of the variable.<\/li><\/ul><\/div><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_easyBrowser\/potw_highlight_variable.png\" alt=\"\"> <\/p><p>Michele&#8217;s easyBrowser provides a few other nice-to-have utilities when you are developing code in MATLAB. One of my favorites is the <tt>nav<\/tt> function. Michele also calls it out as the &#8220;most useful&#8221; in his collection. <tt>nav<\/tt> allows you to add directories and MATLAB files to your &#8220;favorites&#8221;. Then you can easily jump to the directory (or open the file in the Editor) via hyperlink.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_easyBrowser\/potw_nav_favorites.png\" alt=\"\"> <\/p><p>Here are some of the other reasons I like this entry:<\/p><div><ul><li>Plenty of help. Michele includes detailed help for each file, along with an example file.<\/li><li><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/setpref.html\"><tt>setpref<\/tt><\/a> and <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/getpref.html\"><tt>getpref<\/tt><\/a> to manage the favorites. This is a nice way to manage user settings that persist across MATLAB sessions.<\/li><li>OS-independent. He has a function that opens the working directory in the system explorer. There is a convenient function <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/winopen.html\"><tt>winopen<\/tt><\/a> that opens files\/directories in Windows, but it doesn&#8217;t work on Macs or Unix systems. Michele makes sure that his function works on all platforms by checking the OS.<\/li><\/ul><\/div><p>I have one enhancement request. Michele has a folder called &#8220;Internals&#8221; where he puts all internal functions that are used only within his functions. But since this is a regular folder (and on the path), there&#8217;s nothing preventing users or other functions from accidentally calling those internal functions. If they are meant only for internal use, I suggest making them <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/private-functions.html\">private functions<\/a> (put them in a folder called &#8220;private&#8221;) or making them <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_oop\/scoping-classes-with-packages.html\">packages<\/a> (put them in a folder that starts with &#8220;+&#8221;).<\/p><p><b>Comments<\/b><\/p><p>Give it a try and let us know what you think <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=8559#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/62683-easybrowser#comments\">comment<\/a> for Michele.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_9d647a0cb97f47069fcc4776e62a05af() {\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='9d647a0cb97f47069fcc4776e62a05af ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 9d647a0cb97f47069fcc4776e62a05af';\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 2017 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_9d647a0cb97f47069fcc4776e62a05af()\"><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; R2017a<br><\/p><p class=\"footer\"><br>\r\n      Published with MATLAB&reg; R2017a<br><\/p><\/div><!--\r\n9d647a0cb97f47069fcc4776e62a05af ##### SOURCE BEGIN #####\r\n%%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/869871 Jiro>'s\r\n% pick this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/62683-easybrowser easyBrowser>\r\n% by <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/8426716\r\n% Michele Scalseggi>.\r\n%\r\n% When I work on a large project, I usually have files scattered across\r\n% multiple directories with many files open at once in the Editor. Being\r\n% able to quickly navigate through the files and directories becomes really\r\n% important from an efficiency point of view. Some of the Editor features I\r\n% can't live without are\r\n%\r\n% * \"Open file\" context menu. I usually use the shortcut \"Control-D\".\r\n%\r\n% <<potw_open_file_menu.png>>\r\n%\r\n% * \"Change directory\" context menu from the file list tab.\r\n%\r\n% <<potw_change_directory_menu.png>>\r\n%\r\n% * Auto-highlighting of variable names. I then use Alt-<arrow key> to jump\r\n% to the other occurrences of the variable.\r\n% \r\n% <<potw_highlight_variable.png>>\r\n%\r\n% Michele's easyBrowser provides a few other nice-to-have utilities when\r\n% you are developing code in MATLAB. One of my favorites is the |nav|\r\n% function. Michele also calls it out as the \"most useful\" in his\r\n% collection. |nav| allows you to add directories and MATLAB files to your\r\n% \"favorites\". Then you can easily jump to the directory (or open the file\r\n% in the Editor) via hyperlink.\r\n%\r\n% <<potw_nav_favorites.png>>\r\n%\r\n% Here are some of the other reasons I like this entry:\r\n%\r\n% * Plenty of help. Michele includes detailed help for each file, along\r\n% with an example file.\r\n% * <https:\/\/www.mathworks.com\/help\/matlab\/ref\/setpref.html |setpref|> and\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/ref\/getpref.html |getpref|> to\r\n% manage the favorites. This is a nice way to manage user settings that\r\n% persist across MATLAB sessions.\r\n% * OS-independent. He has a function that opens the working directory in\r\n% the system explorer. There is a convenient function\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/ref\/winopen.html |winopen|> that\r\n% opens files\/directories in Windows, but it doesn't work on Macs or Unix\r\n% systems. Michele makes sure that his function works on all platforms by\r\n% checking the OS.\r\n%\r\n% I have one enhancement request. Michele has a folder called \"Internals\"\r\n% where he puts all internal functions that are used only within his\r\n% functions. But since this is a regular folder (and on the path), there's\r\n% nothing preventing users or other functions from accidentally calling\r\n% those internal functions. If they are meant only for internal use, I\r\n% suggest making them\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/private-functions.html\r\n% private functions> (put them in a folder called \"private\") or making them\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/matlab_oop\/scoping-classes-with-packages.html\r\n% packages> (put them in a folder that starts with \"+\").\r\n%\r\n% *Comments*\r\n%\r\n% Give it a try and let us know what you think\r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=8559#respond here> or leave a\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/62683-easybrowser#comments\r\n% comment> for Michele.\r\n\r\n##### SOURCE END ##### 9d647a0cb97f47069fcc4776e62a05af\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_easyBrowser\/potw_open_file_menu.png\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\nJiro&#8216;s pick this week is easyBrowser by Michele Scalseggi.When I work on a large project, I usually have files scattered across multiple directories with many files open at once in the&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2017\/05\/05\/navigating-made-easy\/\">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\/8559"}],"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=8559"}],"version-history":[{"count":5,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/8559\/revisions"}],"predecessor-version":[{"id":8566,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/8559\/revisions\/8566"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=8559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=8559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=8559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}