Why are changes to MATLAB files that are located on a network drive not seen until I clear the function?
4 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2013 年 10 月 18 日
編集済み: MathWorks Support Team
2018 年 4 月 6 日
I am using MATLAB on a PC running Windows XP, and my machine is connected to a network. When I create a new MATLAB file in the 'current directory', (when this is a network directory) while MATLAB is running, MATLAB does not recognize the file.
When I do the following:
1. Map a network drive.
2. Run MATLAB locally.
3. Change directories to the network drive I just mapped.
4. Create a new MATLAB file and save it on the same network drive. (current directory)
5. Run the MATLAB file in MATLAB by typing its name at the prompt.
For some reason MATLAB will not recognize the file.
6. I then use the CLEAR function and this doesn't help.
7. If I add the current directory to the path with the command:
addpath(cd)
the function is now seen.
8. Now I update the file I just created and saved in the network drive, but MATLAB does not recognize the changes.
9. I must type "clear all" or "clear function_name" for the changes to be seen.
However, on my external drive, MATLAB sees the function the first time I create it, but it will not see any changes unless I clear the function.
採用された回答
MathWorks Support Team
2013 年 10 月 18 日
This results from a performance problem. MATLAB often has so many files in directories added to the path, that if it were to read each file every time a function was called, it would run very slowly. This problem is exacerbated by the slow speed of file systems, especially network file systems. Due to this, MATLAB stores the files in the system cache memory. However, doing so leaves the problem of detecting changes to each directory. We use Windows Change Notification Handles (CNH) on Windows to detect these changes. CNHs tell MATLAB when a directory changes so that the directory can be reloaded into memory. CNHs are used because file timestamp checking is too slow.
There are a limited number of CNHs on Windows Systems. When they run out, MATLAB can not detect changes in network directories reliably. This may cause MATLAB not to detect recent changes to a MATLAB file. There are several options for freeing or increasing the numbers of CNHs are available. There are related solutions that provide more information about CNHs.
0 件のコメント
その他の回答 (1 件)
Jonathan
2016 年 4 月 1 日
編集済み: MathWorks Support Team
2018 年 4 月 6 日
Please see this link for a potential workaround: https://groups.google.com/forum/#!topic/comp.soft-sys.matlab/S1JSUN_Xz3Q
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Search Path についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!