MATLAB Answers

Method removed from matlab search path occurs in compiled program

13 views (last 30 days)
Björn Skatt
Björn Skatt on 12 Feb 2019
Commented: Eduardo Gil on 25 Apr 2019
I have a compiled program running constantly, gathering data in a paper mill. Program starts up and works as expected but after several days (thousands of successful method calls), it may throw the following error:
Error using GuiConnectionClass/getCommand:
Method 'getCommand' is not defined for class 'GuiConnectionClass' or is removed from MATLAB's search path.
Has anyone seen this behaviour and understood it?
I have got this error twice in two weeks. I catch the error and try again but once the error occurs, it is persistent. Restarting the program solves the problem. I have not seen the problem in non-compiled code.
The affected method calls the built in webwrite to read the next command from a server:
function cmd = getCommand(c,side)
url = ['http://' c.address '/api/pulp_scan.get_cmd?side=' side];
options = weboptions('Timeout',10); % 0.5s is to short.
cmd = webwrite(url,options);
I am not performing any weird tricks. No messing with the path. No @functionPointers. GuiConnectionClass inherits only handle.
I suspect that the webwrite depends on something under the hood that has silently crashed. I traced webwrite down to matlab.internal.webservices.HTTPConnector and from there it turns into calls of java or .net objects.


Eduardo Gil
Eduardo Gil on 24 Apr 2019
Has anyone provided an answer here? We are experiencing the same problem.
Method 'predict' is not defined for class 'LinearModel' or is removed from MATLAB's search path.
We are running a linear regression in one function (fitlm), and passing the resulting object (from fitlm) to another function. Then we use "predict" in the second function to come up with a forecast. It works fine the Matlab environment, but the compiled code errors out as above.
Björn Skatt
Björn Skatt on 25 Apr 2019
Hi Eduardo. Do you get the error message every time that you start the program? In that case, it is something else. If the error turns up after running the program a long time, see sollution below.
Eduardo Gil
Eduardo Gil on 25 Apr 2019
Hi Bjorn,
It is crashing every time - we are trying to get help from Mathworks. Appreciate your help though -

Sign in to comment.

Accepted Answer

Björn Skatt
Björn Skatt on 25 Apr 2019
When you start up the compiled program, the MCR unpacks all the .m files (encrypted) under the Windows tmp folder. This is a haphazard place to put anything that needs to persist over a long period of time.
I added the following line in the startup script (feel free to come up with a folder of your choice):
Now, the files are stored in a safe place with no risk of periodical cleanup. I have not seen the problem during three weeks of testing. Also, since I run two parallel sessions of the same program, it allows me to use two different folders, avoiding possible clashes.
Thanks to the Matlab support team for working with me on this issue.


Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!

Translated by