R2015a no longer sets the path from pathdef.m upon startup

3 ビュー (過去 30 日間)
Alex R.
Alex R. 2015 年 6 月 15 日
回答済み: Paul Compton 2016 年 9 月 15 日
I just upgraded to R2015a on Windows 8.1 Pro x64. I set Matlab's initial folder to "C:\Users\Alex\Documents\MATLAB" in the GUI. I verified it's set by executing userpath.
I then added a few custom folders to path using addpath c:\code\foo c:\code\bar. Launching pathtool does show indeed the custom folders on top, and executing functions from those folders works.
I then saved the current path definitions from the pathtool GUI, which creates pathdef.m inside "C:\Users\MYNAME\Documents\MATLAB\pathdef.m". I verified that pathdef.m does indeed contain c:\code\foo and c:\code\bar
However, upon starting Matlab, my custom folders are no longer in the path. It's always reset to the default set of dirs.
The exact same procedure in R2014b works just fine, but not in R2015a. Any clues?
Alex.
p.s. I don't want to edit files in MATLAB\R2015a\toolboxes\local. As a workaround right now I created a file C:\Users\Alex\Documents\MATLAB\startup.m where I call path(pathdef); which does what Matlab is supposed to do upon startup ...

回答 (4 件)

Eric Lin
Eric Lin 2015 年 6 月 16 日
The steps you described should allow you to save custom folders to the path. One suggestion is to check if there are multiple pathdef.m files on the path, which could lead to inconsistencies in where MATLAB reads and writes path data, by using the "which" command:
which -all pathdef
If the issue persists, I recommend contacting MathWorks Tech Support.

Alex R.
Alex R. 2015 年 6 月 16 日
There are two files, but one is shadowed, here's the output:
>> which -all pathdef
C:\Users\Alex\Documents\MATLAB\pathdef.m
P:\matlab\R2015a\toolbox\local\pathdef.m % Shadowed
However, R2014b says exactly the same thing and doesn't have any issues:
>> which -all pathdef
C:\Users\Alex\Documents\MATLAB\pathdef.m
P:\matlab\R2014b\toolbox\local\pathdef.m % Shadowed
  2 件のコメント
Ken Atwell
Ken Atwell 2015 年 6 月 17 日
Two further things to check (and report back to us):
  • The path returned by 'userpath' in both 14b and 15a
  • The values of your "General" preferences as described in this section of the doc.
Alex R.
Alex R. 2015 年 6 月 17 日
編集済み: Alex R. 2015 年 6 月 17 日
I already mentioned those in my first post. Once again:
>> userpath
ans =
C:\Users\Alex\Documents\MATLAB;
Same value for the initial working folder. Same in both 15a and 14b.

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


Julia
Julia 2015 年 6 月 17 日
編集済み: Julia 2015 年 6 月 17 日
Hi,
I had a similar problem with my new installation of 2014b.
The Matlab support only suggested a work around ...
My solution: every time I add a new folder I move the matlab folder, which is the result of "userpath", to the top of the list in the pathtool and save.
I don't know why, but it works for me.
  2 件のコメント
Alex R.
Alex R. 2015 年 6 月 17 日
編集済み: Alex R. 2015 年 6 月 17 日
Then it's a bug in 15a. I don't have to do that in 14b. For now I just call path(pathdef); in startup.m which I placed in the userpath Matlab folder next to pathdef.m. You may try the same as it saves you the trouble of moving the userpath folder to the top every time.
Julia
Julia 2015 年 6 月 17 日
Thanks for the advice!

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


Paul Compton
Paul Compton 2016 年 9 月 15 日
The bug in I see in 2015b (and probably 2015a as well) is that saving the pathdef to an alternate location using the GUI does NOT properly name the file. It saves it as pathdef rather than pathdef.m, so it is ignored when MATLAB starts up. Renaming the file to the required name "pathdef.m" allows it to work as expected, at least in my situation here . . .

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by