The issue here appears to be that the custom function named "lookup” (and "update") conflicts with a Java class named "lookup” (and "update") that was introduced in R2015a by Robotics System Toolbox. In MATLAB, a Java constructor has higher precedence than a function in an M file of the same name. This is causing the error message. Thanks, Dr. Andrea for reporting this issue. Our team has already noticed this issue and we are evaluating this issue.
There are several potential workarounds:
1) Re-name the "lookup" (“update”) custom function. Using some name that may identify the custom function would be the best practice. This might be the best way to avoid any issue in the future. We are also working on nodulizing our toolbox, which might be accomplished in the future release of MATLAB.
2) You could create a custom package folder, add custom function "lookup" (“update”) into that package folder, and then update all references to "lookup" (“update”) in the toolbox files to call "lookup" with the package name prepended. For more information about this workflow, see the following documentation link:
3) Since this Java constructor is introduced by Robotics System Toolbox, if you do not use this toolbox, then uninstalling this toolbox will also resolve this issue.
4) The "lookup" and "update" Java constructors are introduced by "dnsjava.jar", which is used to call a DNS server to get the IP address for host names that the user provides.
Thus, if you use ROS (Robot Operating System), but always connects to ROS systems via IP address, then there is a better workaround instead of uninstalling the toolbox. We could remove this Java class from the Java path. Since we know which Java class causes this issue, then it is easier for us to prevent MATLAB to load this class.
Please try the following steps:
1. Close MATLAB.
2. Open the file matlabroot/toolbox/local/classpath.txt. Note that this might require administrative access.
3. Find the following line: $matlabroot/java/jarext/rosjava/dnsjava.jar
4. Cut "$matlabroot/java/jarext/rosjava/dnsjava.jar", and paste it into the end of the file.
5. Put a number sign (#) in front of "$matlabroot/java/jarext/rosjava/dnsjava.jar", so we have # $matlabroot/java/jarext/rosjava/dnsjava.jar
6. Finally, restart MATLAB. From now, MATLAB would not load this Java class and the"lookup" Java constructor in issue will be gone.
If you need the DNS service later, just delete the number sign and MATLAB will load this Java class again.
(Note please contact MathWorks Technical Support if removing the dnsjava.jar will affect your existing projects.)