{"id":4234,"date":"2012-04-11T17:49:15","date_gmt":"2012-04-11T16:49:15","guid":{"rendered":"http:\/\/www.walkingrandomly.com\/?p=4234"},"modified":"2012-04-30T16:17:54","modified_gmt":"2012-04-30T15:17:54","slug":"workaround-for-a-bug-in-the-matlab-2012a-installer","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=4234","title":{"rendered":"Workaround for a bug in the MATLAB 2012a installer"},"content":{"rendered":"<p>I recently installed MATLAB 2012a on a Windows machine along with a certain set of standard Mathworks toolboxes.\u00a0 In addition, I also installed the excellent <a href=\"http:\/\/www.nag.co.uk\/numeric\/MB\/start.asp\">NAG Toolbox for MATLAB<\/a> which is standard practice at\u00a0my University.<\/p>\n<p>I later realised that I had not installed all of the Mathworks toolboxes I needed so I fired up the MATLAB installer again and asked it to add the missing toolboxes.\u00a0 This extra installation never completed, however, and gave me the error message<\/p>\n<pre>The application encountered an unexpected error and needed to close. You may want to try\r\nre-installing your product(s). More infomation can be found at C:\\path_to_a_log_file<\/pre>\n<p>I took a look at the log file mentioned which revealed a huge java error that began with<\/p>\n<pre>\u00a0java.util.concurrent.ExecutionException: java.lang.StringIndexOutOfBoundsException:\r\n    String index out of range: -2\r\n\u00a0at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)\r\n\u00a0at java.util.concurrent.FutureTask.get(Unknown Source)\r\n\u00a0at javax.swing.SwingWorker.get(Unknown Source)\r\n\u00a0at com.mathworks.wizard.worker.WorkerImpl.done(WorkerImpl.java:33)\r\n\u00a0at javax.swing.SwingWorker$5.run(Unknown Source)<\/pre>\n<p>A little mucking around revealed that the installer was unhappy with the pathdef.m file at <strong>C:\\Program Files\\MATLAB\\R2012a\\toolbox\\local\\pathdef.m <\/strong><\/p>\n<p>The installer for the NAG Toolbox modifies this file by adding the line<\/p>\n<pre>'C:\\Program Files\\MATLAB\\R2012a\\toolbox\\NAG\\mex.w64;' ...<\/pre>\n<p>near the beginning and the lines<\/p>\n<pre>'C:\\Program Files\\MATLAB\\R2012a\\help\\toolbox\\NAG;' ...\r\n'C:\\Program Files\\MATLAB\\R2012a\\help\\toolbox\\NAGToolboxDemos;' ...<\/pre>\n<p>Near the end and it seems that the MATLAB installer really doesn&#8217;t like this.  So, what you do is create a copy of this pathdef.m file (pathdef.m.old for example) and then remove the non-mathworks lines in pathdef.m. Now you can install the extra Mathworks toolboxes you want.\u00a0 Once the installer has finished its work you can re-add the non-mathworks lines back into pathdef.m using your copy as a guide.<\/p>\n<p>I&#8217;ll be informing both NAG and The Mathworks about this particular issue but wanted to get this post out there as soon as possible to provide a workaround since at least one other person has hit this problem at my University and I doubt that he will be the last (It&#8217;s also going to make SCCM deployment of MATLAB a pain but that&#8217;s another story).<\/p>\n<p><strong>Update<\/strong><\/p>\n<p>The Mathworks technical support have sent me a better workaround than the one detailed above.  What you need to do is to change<\/p>\n<pre>\r\n'C:\\Program Files\\MATLAB\\R2012a\\toolbox\\NAG\\mex.w64;' ...\r\n<\/pre>\n<p>to<\/p>\n<pre>\r\n'C:\\Program Files\\MATLAB\\R2012a\\toolbox\\NAG\\mex.w64;', ...\r\n<\/pre>\n<p>The Mathworks installer is unhappy about the missing comma.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently installed MATLAB 2012a on a Windows machine along with a certain set of standard Mathworks toolboxes.\u00a0 In addition, I also installed the excellent NAG Toolbox for MATLAB which is standard practice at\u00a0my University. I later realised that I had not installed all of the Mathworks toolboxes I needed so I fired up the [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[11,28],"tags":[],"class_list":["post-4234","post","type-post","status-publish","format-standard","hentry","category-matlab","category-nag-library"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-16i","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/4234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4234"}],"version-history":[{"count":7,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/4234\/revisions"}],"predecessor-version":[{"id":4266,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/4234\/revisions\/4266"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}