フィルターのクリア

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

16 ビュー (過去 30 日間)
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
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.
Zaida Escila Martínez Moreno
Zaida Escila Martínez Moreno 2023 年 8 月 4 日
Because I don't have rights to add pathdef.m into that folder. I can only add it in my home directory.

サインインしてコメントする。

採用された回答

Image Analyst
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 件のコメント
Zaida Escila Martínez Moreno
Zaida Escila Martínez Moreno 2023 年 8 月 4 日
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
Zaida Escila Martínez Moreno 2023 年 8 月 4 日
編集済み: Zaida Escila Martínez Moreno 2023 年 8 月 4 日
It works great! Thank you very much!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSearch Path についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by