How to get Matlab to reload an m file
21 次查看(过去 30 天)
显示 更早的评论
I'm trying Matlab for the first time. Since I prefer Emacs-like editors, I've been using an external editor on .m files. I was trying to find the source of odd bugs in my code, when in fact, Matlab was caching older versions of .m files. Finally exited Matlab and it loaded the correct files on restart. I should have realized sooner what was going on. Matlab is evidently not detecting that the files have changed, even though I can double click them in Matlab's "Current folder" window and see all the updates.
This then appears to be caused by an internal caching mechanism. Is there any way to tell Matlab to load the externally edited file?
MG
PS: The word "Matlab" is flagged by Mathworks' spell checker? :-)
0 个评论
采纳的回答
Walter Roberson
2013-11-17
If the function file name is YourFunction.m then
clear YourFunction
Note: Mathworks does not have a spell checker on the forum. Any spell checking is being done by your browser.
2 个评论
Walter Roberson
2013-11-18
It would be inefficient to go through the file system looking for files that might have changed. Therefore for efficiency it would be necessary to request for each file (or directory at least) that the operating system notify the program if the file (or directory) had changed. Unfortunately adding many sources to such a list is inefficient at the operating system level -- and MS Windows has relatively low limits on the number of watch handles that one can request.
There are circumstances under which MATLAB checks, but I do not recall what they are at the moment.
更多回答(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!