|
Dear Brendan!
> I often will edit a matlab m file on one computer, and copy the file to a machine that is more powerful and has more resources for execution. However, I am having the following incredibly frustrating problem: many times the when I copy over an old version of an m-file with a new version, the code from the old version is run instead. I believe this has to do with the compilation of the m files, i.e. there is some intermediate code file from the old m code (.asv I think) that is being run instead of the new m code. I had been calling the 'rehash' command recently, which seemed to work better (i.e. my new code was run often than before), but I still have cases when the old code is run instead. I have also tried the refresh command with no success.
>
> Does anyone know a resolution to this problem? It is insanely frustrating to run a program that takes one hour, only to find out afterwards it ran the old version of the code.
The .asv files are just backups of the M-files and they are not used for processing. But there are copies of the M-files in the memory. Usually they are replaced if newer versions of the files are available, but this may fail if you work on a network drive and the "change notification handles" of the operating system are exhausted. Fortunately there is a tool which never fails to remove the M-functions from the memory: CLEAR.
Either clear the specific file, e.g. myFunc.m:
clear myFunc
or all functions:
clear functions
Did you try "rehash pathreset" ? I'd expected, that this works well. But I'd rely on CLEAR.
Good luck, Jan
|