Having created a function file "z_estimate.m" and successfully called the function (from the command line), I noticed I had inadvertently saved the file in the top-level MATLAB folder instead of the subfolder "my_functions", which is also on my Matlab path. So, I dragged the .m file from the top level into the subfolder, in the Matlab filemanager window. Now when I call that function I get the error
Previously accessible file
is now inaccessible.
In an attempt to diagnose the issue, I used "Save as..." to save a copy of the function as "z_estimate2.m" (and changed the function name to "z_estimate2"). When I call z_estimate2, it works. But I don't want my function to be called that if possible, and in future I don't want to have to rename functions if I move them.
I tried using "restoredefaultpath" from the command line and then re-adding "my_functions" to the path, but the original function won't run. If I move it back to "MATLAB" it works fine, however, I don't want all my functions in the top-level folder, I would like to be able to organise them into subfolders.
For information, I am running Windows 7. I found another question about this error, to which the answer referred to changing system TEMP variable, so mine is:
How can I move a function file between two folders that are both on the Matlab path and still be able to call them?