Why are newly created files in a network drive folder not immediately recognized by MATLAB?

7 views (last 30 days)
I am working with many scripts within MATLAB for one large project that is located on a mapped network drive. I'm facing an issue where newly-created scripts are unrecognized by MATLAB and cannot be run, although pre-existing scripts are properly recognized. I've also noticed that using "Check Code Generation Readiness" by right clicking any new files allows MATLAB to recognize the file, after which I can use it as normal.
This issue does not exist when the files are located on a local disk, although I'd prefer to continue using these scripts on the mapped network drive. Are there any workarounds I can take to continue using the network drive?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 6 Jun 2022
Due to a large number of files on the MATLAB search path (mostly from MATLAB base product and additional toolboxes), MATLAB caches information on all files located on its path and does not refresh this index unless notified by the underlying OS or manually instructed to do so. This is done for performance reasons.
MATLAB, when running on Windows, makes use of Microsoft's "Change Notification Handle" feature which enables MATLAB to be notified any time a file in a directory on the path is modified. Under certain circumstances, Windows may fail to provide MATLAB with a valid and responsive handle. A possible cause of this is that the network or fileserver latency delays the arrival of the change notification, resulting in changes not being immediately detected.
For more information about "Change Notification Handles", along with workarounds you can take to resolve this issue, please see this MATLAB Answers post:
In particular, try taking the workaround in step 4 of the MATLAB Answers post to quickly and temporarily resolve the issue. You can also manually refresh the changes to files and folders in the MATLAB path by executing the following in the MATLAB Command Window:
>> rehash
For more information about the "rehash" command, please refer to the following documentation page:

More Answers (0)

Categories

Find more on Search Path in Help Center and File Exchange

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!