Error when opening two Matlab versions at the same time due to pathdef.m. How to fix it?
9 views (last 30 days)
Show older comments
Zaida Escila Martínez Moreno
on 4 Aug 2023
Edited: Zaida Escila Martínez Moreno
on 21 Sep 2023
I use Matlab 2019b mainly because most of my project has been coded in that version, and therefore, I have set up a pathdef.m file with some functions that I've written. However, when I want to produce graphs, it is easier and nicer to use Matlab 2021b. Everytime that I open Matlab 2021b, while pathdef.m is in my home directory, it fails with multiple errors (see at the end). The only way of opening Matlab 2021 is for me to rename pathdef to something else, and then change it back when I want to use Matlab 2019b. This is not ideal for me, so I would appreciate if anyone could help me figure out how to be able to open both Matlabs without having to modify pathdef.m
Thank you!
ERROR CODE that appears immediately after opening Matlab:
Warning: Name is nonexistent or not a directory: /export01/local/matlab21b/toolbox/matlab/codeanalysis/analysis
... (many more warnings like these) ...
Warning: Name is nonexistent or not a directory: /export01/local/matlab21b/toolbox/nav/navslamapp
Error using builtin
Can't find the resource file 'toolbox/matlab/graphics/hg/hgrc.m' needed by '/export01/local/matlab21b/bin/glnxa64/libmwhg.so'
Error in matlab.graphics.internal.initialize (line 15)
suppressedOutput = evalc('builtin(''groot'');');
Error in matlab.internal.doc.services.getDocLanguageLocale (line 11)
sysLang = get(0, 'Language');
Error in matlab.internal.doc.csh.DocPageTopicMap.accessDocLanguage (line 74)
docLang = matlab.internal.doc.services.getDocLanguageLocale;
Error in matlab.internal.doc.csh.getLocalizedFileList (line 14)
docLang = matlab.internal.doc.csh.HelpTopicMap.accessDocLanguage;
Error in matlab.internal.doc.csh.findDocCatalogFiles (line 9)
files = matlab.internal.doc.csh.getLocalizedFileList(folder, shortname, extension);
Error in matlab.internal.doc.csh.DocPageTopicMap/retrieveHelpTargets (line 159)
files = matlab.internal.doc.csh.findDocCatalogFiles("cshapi_helptarget", obj.shortname);
Error in matlab.internal.doc.csh.DocPageTopicMap/mapSingleTopic (line 84)
retrieveHelpTargets(obj);
Error in matlab.internal.doc.csh.DocPageTopicMap/mapTopic (line 32)
docPage(i) = mapSingleTopic(obj, topicId(i));
Error in matlab.internal.doc.csh.HelpTopicMap/mapTopic (line 13)
docPages = mapTopic@matlab.internal.doc.csh.DocPageTopicMap(obj, topicId);
Error in matlab.internal.doc.csh.mapTopic (line 5)
helpPath = helpTopicMap.mapTopic(topicId);
Error in matlab.internal.language.introspective.getExtendedErrorCallback (line 5)
path = matlab.internal.doc.csh.mapTopic(shortname, topicId);
Unrecognized function or variable 'matlab.internal.debugger.breakpoints.initBreakpointsStoreInstance'.
Unrecognized function or variable 'matlab.internal.debugger.breakpoints.initBreakpointsStoreInstance'.
2 Comments
DGM
on 4 Aug 2023
In all the versions of MATLAB I have, pathdef.m is in
$MLROOT/toolbox/local/pathdef.m
I don't know why you have pathdef.m in the home directory.
Accepted Answer
Image Analyst
on 4 Aug 2023
Each version of MATLAB should have it's own pathdef and be independent. You can add paths to it with the Set Path button on the toolbar, but may not (at least in Windows) be able to modify it yourself. But you should not do that anyway. If you have custom paths you want to set up, do what I do : use addpath() in your startup.m file. I have my startup.m file in the Document/MATLAB folder. When I install a new MATLAB release, I just use the Set Path button to point to that folder so the startup.m file will get run. You only need to do this once, just after installation. Once that's done, all your versions of MATLAB will run the same startup.m file and thus will have the same folders added to the search path.
5 Comments
More Answers (0)
See Also
Categories
Find more on Search Path in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!