MATLAB:UndefinedFunction error, even when file is found on path

2 views (last 30 days)
I have an .m file that I would like to run called bacteria2, however, I can't seem to convince MATLAB (R2016a, OSX 10.11) to run it. When I attempt to execute
This results in the error message
Undefined function or variable 'bacteria2'.
In case it helps to know which error code is being triggered, the error id from
[errMsg,errId] = lasterr
However, attempting to open the program in the editor from the command line works fine. That is,
opens the correct copy of 'bacteria2' in my Dropbox folder for editing. The issue seems to be something to do with the fact that there are odd characters in the path.
Gives an output of
/Users/benbratton/Dropbox/Alex L <> Ben B/bacteria2.m
Another symptom of this path issue is the inability to enable breakpoints in the file. Once the file is open in the editor, any attempt to enable a breakpoint in the editor results in the following error message
My workaround is to move the file to a different location and then manually copy it over to dropbox when I want to share changes with my collaborator. It would be great to have a better solution.
Benjamin Bratton
Benjamin Bratton on 1 Nov 2016
Thanks! I agree that SVN/git are great tools for version tracking and managing conflicts. In addition, I find it really convenient to be able to switch between feature sets by simply checking out a different branch. We decided on Dropbox for this particular situation because not all of my coworkers are willing to make the jump to git.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 1 Nov 2016
lasterr does not change until you either overwrite it or a new error occurs. You have not shown us bacteria2 failing: what you show is the possibility that it worked fine but lasterr had happened to be set to that before bacteria2 was run.
You should also consider the possibility that MATLAB is not able to access the file directly off of Dropbox . You might need to copy the file locally.
Benjamin Bratton
Benjamin Bratton on 10 Nov 2016
Thanks for the tip, unfortunately my error does not seem to be Dropbox related. I made new fictitious directories containing "<", "<>", "><" and ">". All folders including ">" in the path result in this error. The folder with only a "<" was perfectly acceptable to MATLAB's parser.

Sign in to comment.



Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!