Effacer les filtres
Effacer les filtres

Error when opening two Matlab versions at the same time due to pathdef.m. How to fix it?

16 vues (au cours des 30 derniers jours)
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 commentaires
DGM
DGM le 4 Août 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.
Zaida Escila Martínez Moreno
Because I don't have rights to add pathdef.m into that folder. I can only add it in my home directory.

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 4 Août 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 commentaires
Zaida Escila Martínez Moreno
It is an institutional computer, so I have very limited access to any folder outside my home.
I had understood from your previous comment that it was enough to have one startup.m file, as both Matlab versions could use the same one. Is that assumption wrong?
When I used "edit(fullfile(userpath,'startup.m'))", it opened a file that was inside my home/matlab folder. I have added the paths this way:
%------------- ADD PATHS -----------------------------%
addpath /home/user/Scripts
addpath /home/user/matlab
addpath /meg/meg1/software/brainstorm3
And I am about to test it out.
Zaida Escila Martínez Moreno
Modifié(e) : Zaida Escila Martínez Moreno le 4 Août 2023
It works great! Thank you very much!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Search Path dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by