Not able to save toolbox folders to pathdef.m in MATLAB 2025b
72 views (last 30 days)
Show older comments
Titas Bucelis
on 2 Oct 2025 at 16:42
Commented: dpb
on 4 Oct 2025 at 22:11
Hi,
I am running issues with the addon/toolbox path behaviour in MATLAB 2025b. My only other reference is MATLAB 2022b in which it works fine.
I have 2 toolboxes installed that I care about:
Name Version Enabled Identifier
_________________________________________ _________ _______ ______________________________________
"GUI Layout Toolbox" "2.3.5" true "e5af5a78-4a80-11e4-9553-005056977bd0"
"Widgets Toolbox" "1.3.330" true "b0bebf59-856a-4068-9d9c-0ed8968ac9e6"
When I launch MATLAB it's all ok and I see the folders needed in path:
C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox
C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox\demo
C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox\doc
C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox\doc\helpsearch-v3
C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox\resource
C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox\widgets
C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\GUI Layout Toolbox\layout
C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\GUI Layout Toolbox\layoutdoc
However, I when I use path(pathdef) to reset paths (which used to reset to the same state as at launch in my case), the folders for these toolboxes disappear.
I can see that they are not defined in pathdef.m, and if I call savepath after launching MATLAB, these folders will not get saved even if they are on the path, because for some reason they are in the ExcludePathStore list:
>> matlab.internal.path.ExcludedPathStore.getCurrentExcludeList()'
ans =
8×1 string array
"C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox"
"C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox\demo"
"C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox\doc"
"C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox\doc\helpsearch-v3"
"C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox\resource"
"C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Widgets Toolbox\widgets"
"C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\GUI Layout Toolbox\layout"
"C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\GUI Layout Toolbox\layoutdoc"
so my question is - is there a way to replace path(pathdef) with something that includes the toolbox folders as on MATLAB startup? I can find the install paths of the addons but with genpath it would end up including more folders than needed.
I could use matlab.internal.path.ExcludedPathStore.getCurrentExcludeList() to add them but not sure if that's the best approach as it's an internal class with no documentation that I could find.
5 Comments
Steven Lord
on 4 Oct 2025 at 16:20
I was having a little trouble responding to this post on my machine yesterday, but the problem seems to have subsided.
Rather than manually trying to control the path yourself, if you're working on projects that include lots of files where each project needs a different subset of directories to be on the path I'd consider using the Projects functionality included in MATLAB. This will handle adding directories to the path when you start working on a project and restoring the path to its previous state (note this is different than either "removing directories from the path" or "restoring the path to its default") when you stop working on that project and/or switch to working on a different project.
dpb
on 4 Oct 2025 at 22:02
So, can you expound some on the "why" behind this, Steven, and what determines which TB files will/will not be on the list and why?
Accepted Answer
Titas Bucelis
on 4 Oct 2025 at 12:48
3 Comments
dpb
on 4 Oct 2025 at 22:11
Well, that doesn't help, it turns out because on R2022b exist can't find the hidden/private file as it does on R2025. Nor can which so one would have to do an exhaustive file search to locate it.
I never have built anything large enough that seemed to justify a project; it appears to have been introduced in R2019a but R2019b doesn't incorporate it yet, so still not at all clear as to why it was introduced. As you note, it appeared by R2021b in the +language folder as well as R2022b, the latest version I've installed so far.
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!