SchluckWasser
SchluckWasser

Reputation: 31

Matlab Unknown class error after compiling script containing TCPIP

I compiled a script that uses the tcpip function from the instruments toolbox using MCR_R2015a. Running the generated executable on the PC I used for compiling (Windows7) is not a problem, however running it on another PC (Windows10, no Matlab installed) is. I receive the following error:

unknown variable com or unknown class com.mathworks.toolbox.instrument.TCPIP

pointing to line 123 in tcpip. The surrounding code is:

try
    obj.jobject = handle(com.mathworks.toolbox.instrument.TCPIP(host,port));
catch aException
    newExc = MException('instrument:tcpip:cannotCreate',aException.message);
    throw(newExc);        %%% this is line 123
end

Obviously com.mathworks.toolbox.instrument.TCPIP is not known. I tried to find the file defining this object to append it when compiling without success.

Where to find that file or how to compile a running executable?

Upvotes: 3

Views: 80

Answers (1)

SchluckWasser
SchluckWasser

Reputation: 31

As I was able to run the script inside Matlab but not the executable using the Matlab compiler runtime, I figured an unset path in the MCR may cause the error.

Not being able to find the file were the path to the TCPIP class is defined, I ended up deinstalling the MCR. Et voilá, it worked!

I am aware this solution is not answering the question how to compile scripts containing the tcpip function and running the generated exe on PCs that have no Matlab installed. But it is good enough for me.

Upvotes: 0

Related Questions