{"id":6675,"date":"2016-03-11T13:06:53","date_gmt":"2016-03-11T18:06:53","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=6675"},"modified":"2016-03-11T13:06:53","modified_gmt":"2016-03-11T18:06:53","slug":"export-search-path","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2016\/03\/11\/export-search-path\/","title":{"rendered":"Export Search Path"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      <p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3208495\">Sean<\/a>'s pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/50087-export-search-path\"><tt>export_search_path<\/tt><\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/869215\">John D'Errico<\/a>.\r\n      <\/p>\r\n   <\/introduction>\r\n\r\n   <p>Approximately every six months, a new release of MATLAB comes out.  Our spring release, R2016a, just came out March 3rd. \r\n      When you upgrade, your preferences from the previous release are carried over, but the search path is not.\r\n   <\/p>\r\n   <p>This is where John's tool comes in.  Rather than having to look at the <tt>pathtool<\/tt> for both releases or manually copying from <tt>pathdef.m<\/tt>, John's function exports the non-MathWorks paths from the old release's path definition to be imported into the new one.\r\n   <\/p>\r\n   <p>In R2015b run:<\/p><pre>export_search_path<\/pre><p>This generates a MAT file that contains the path and a new function, <tt>import_search_path<\/tt>, to be run in the new release.\r\n   <\/p>\r\n   <p>Now in R2016a run:<\/p><pre>import_search_path<\/pre><p><b>All Done!<\/b><\/p>\r\n   <p>If you do want to do this manually, or inspect the results, then use <tt>pathtool<\/tt>.\r\n   <\/p><pre>pathtool<\/pre><p>The one thing that this does not take into account is hardware support packages which are release specific.  If you installed\r\n      these in the older release, be sure to remove them explicitly in the new release before installing the corresponding ones\r\n      for the new release.  New ones can be installed from the Add-Ons explorer, accessible from the <b>Home<\/b> tab.\r\n   <\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainexportsearchpath\/addons.png\"> <\/p>\r\n   <h3>Comments<a name=\"2\"><\/a><\/h3>\r\n   <p>Have you upgraded to R2016a yet?  Be sure to browse through the <a href=\"https:\/\/www.mathworks.com\/help\/relnotes\/index.html\">release notes<\/a> and share your favorite new features!\r\n   <\/p>\r\n   <p>Give it a try and let us know what you think <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=6675#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/50087-export-search-path#comments\">comment<\/a> for John.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_d9fe7d04d7c044c78834a7b411ebf65b() {\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='d9fe7d04d7c044c78834a7b411ebf65b ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' d9fe7d04d7c044c78834a7b411ebf65b';\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 = 'Sean de Wolski';\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 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_d9fe7d04d7c044c78834a7b411ebf65b()\"><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; R2016a<br><\/p>\r\n<\/div>\r\n<!--\r\nd9fe7d04d7c044c78834a7b411ebf65b ##### SOURCE BEGIN #####\r\n%% Export Search Path\r\n%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3208495 Sean>'s pick this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/50087-export-search-path |export_search_path|> by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/869215 John D'Errico>.\r\n% \r\n\r\n%% \r\n% Approximately every six months, a new release of MATLAB comes out.  Our\r\n% spring release, R2016a, just came out March 3rd.  When you upgrade, your\r\n% preferences from the previous release are carried over, but the search\r\n% path is not. \r\n%\r\n% This is where John's tool comes in.  Rather than having to look at the\r\n% |pathtool| for both releases or manually copying from |pathdef.m|, John's\r\n% function exports the non-MathWorks paths from the old release's path\r\n% definition to be imported into the new one.\r\n%\r\n% In R2015b run:\r\n%\r\n%  export_search_path\r\n%\r\n% This generates a MAT file that contains the path and a new function,\r\n% |import_search_path|, to be run in the new release.\r\n%\r\n% Now in R2016a run:\r\n%\r\n%  import_search_path\r\n%\r\n% *All Done!*\r\n%\r\n% If you do want to do this manually, or inspect the results, then use\r\n% |pathtool|.\r\n%\r\n%  pathtool\r\n%\r\n% The one thing that this does not take into account is hardware support\r\n% packages which are release specific.  If you installed these in the older\r\n% release, be sure to remove them explicitly in the new release before\r\n% installing the corresponding ones for the new release.  New ones can be\r\n% installed from the Add-Ons explorer, accessible from the *Home* tab.\r\n%\r\n% <<addons.png>>\r\n\r\n%% Comments\r\n% \r\n% Have you upgraded to R2016a yet?  Be sure to browse through the\r\n% <https:\/\/www.mathworks.com\/help\/relnotes\/index.html release notes> and\r\n% share your favorite new features!\r\n%\r\n% Give it a try and let us know what you think\r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=6675#respond here> or leave a\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/50087-export-search-path#comments\r\n% comment> for John.\r\n%\r\n \r\n\r\n##### SOURCE END ##### d9fe7d04d7c044c78834a7b411ebf65b\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainexportsearchpath\/addons.png\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\n   \r\n      Sean's pick this week is export_search_path by John D'Errico.\r\n      \r\n   \r\n\r\n   Approximately every six months, a new release of MATLAB comes out.  Our spring release, R2016a, just came... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2016\/03\/11\/export-search-path\/\">read more >><\/a><\/p>","protected":false},"author":87,"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\/6675"}],"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\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=6675"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/6675\/revisions"}],"predecessor-version":[{"id":6676,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/6675\/revisions\/6676"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=6675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=6675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=6675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}