One aspect of the MATLAB search path is the toolbox path cache. When your program calls a MATLAB function, the interpreter needs to know where to find the code associated with that function. Rather than scouring all the toolbox folders on your path each function call, MATLAB caches information about those files and folders.
Toolbox caching happens by default in the background, and most of the time you never need to know about it. There are two times when this might become important to you. The first is registering changes if you update or modify toolbox files. The other is at MATLAB startup, where the cache is used to improve startup time.
For both of these cases, let’s look at the General MATLAB preferences:
“Enable toolbox path cache” is on by default. Turning this off will make MATLAB load more slowly. I can’t think of a good reason to turn this off, but when caching is used and you update a file under the toolbox directory, you’ll have to press the “Update Toolbox Path Cache” button to refresh the cache. If you don’t update the cache, you might get unexpected behavior or an “undefined function or variable” error. The cache is automatically updated by the installer, so you don’t have to worry about it when upgrading to a new release.
The diagnostics checkbox shows some information at startup about how much time is spent reading the cache. This may be useful to tech support or interesting to a curious MATLAB geek, but I recommend leaving it un-checked.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.