Error when opening two Matlab versions at the same time due to pathdef.m. How to fix it?
9 次查看(过去 30 天)
显示 更早的评论
Zaida Escila Martínez Moreno
2023-8-4
编辑: Zaida Escila Martínez Moreno
2023-9-21
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 个评论
DGM
2023-8-4
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.
采纳的回答
Image Analyst
2023-8-4
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Search Path 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!