I'm running MATLAB 2018a. (Yeah, I know. Corporate IT.)
I have an m-file that pulls in functions from several other m-files.
Yesterday, I ran into a problem because the function that was pulled in and ran was not the function I wanted or expected.
Specifically, my main function runs a function called instrRack. This function is defined inside an m-file named instrRack.m.
I expected to get the instrRack function from the file C:\git\unified-cryo\unified\Instruments\@instrRack\instrRack.m.
Instead, the instrRack function came from the file C:\git\unified-cryo\adr\Instruments\@instrRack\instrRack.m
I discovered this by digging through the error stack returned by the use of the incorrect instrRack function.
Note that the correct file is "unified-cryo\unified" while the incorrect file is "unified-cryo\adr".
I don't believe I've seen this problem before and I've been using my main function for months, if not years.
As far as I could tell, my MATLAB path was correct. Specifically, C:\git\unified-cryo\unified was at the top of the path, with C:\git\unified-cryo\unified\Instruments a few entries below that.
Unless I missed something, C:\git\unified-cryo\adr was nowhere in the MATLAB path.
Other people use MATLAB on the same test stand. Could one of them have used a path that included the incorrect m-file, and that incorrect m-file or path somehow persisted into my MATLAB session?
I tried killing and restarting my MATLAB session several times, each time verifying that my MATLAB path was correct. However, I kept getting the function from the wrong m-file.
I wound up having to restart the PC in order to get the function from the correct m-file.
Any suggestions on why I kept getting the function from the wrong m-file?