Error in matlab MCR undefined variable nnMex

Hi, please, can you help me with this?.
I have trained a neural network and wrote a matlab code to load network and simulate it with an input:
function recomendacion=recomendar_C_A1(input)
load("RN_C_A1.mat","RN_C_A1");
recomendacion=sim(RN_C_A1,input);
end
And i compiled a jar file for use it on my java module, that expose a SOAP service.
I have implemented the jar file and i have success, my module works on an apache tomcat server on windows, but when i tried to deploy it on a linux server with apache tomcat installed and MCR installed it doesn´t work, I added MCR path to CLASSPATH but my code crashes with this error:
... Matlab M-code Stack Trace ...
file /root/.mcrCache9.5/Recome0/toolbox/nnet/nnet/nnderivative/+nnMex/y.m, name y, line 8.
file /root/.mcrCache9.5/Recome0/toolbox/nnet/nnet/nnderivative/nnCalcLib.m, name nnCalcLib.y, line 113.
file /root/.mcrCache9.5/Recome0/toolbox/nnet/nnet/@network/sim.p, name simPerWorker, line 353.
file /root/.mcrCache9.5/Recome0/toolbox/nnet/nnet/@network/sim.p, name sim, line 305.
file /root/.mcrCache9.5/Recome0/Recomendacio/recomendar_C_A1.m, name recomendar_C_A1, line 3.
com.mathworks.toolbox.javabuilder.MWException: Undefined variable "nnMex" or class "nnMex.yy".

回答(1 个)

As stated in the "Fixing Callback Problems: Missing Functions" section of this documentation page:
"Dependent functions can also be hidden from the dependency analyzer in .mat files that are loaded by compiled applications. Use the mcc -a argument or the %#function pragma to identify .mat file classes or functions that are supported by the load command."
There's nothing in the function you posted to indicate that the variable you're reading in using load is a network object. Consider doing what that note says to make clear to the dependency analyzer that this function does in fact depend upon the neural network object class.

类别

在 帮助中心 和 File Exchange 中查找有关 Deploy to Java Applications Using MWArray Data API 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by