Problem with integration of a trained neural network by matlab into java
2 views (last 30 days)
Show older comments
I'm working on my important year project. I need to load Matlab neural network from Java.
This is the method I have created to load the neural network:
function result = compute(inputs)
%#function network
load mynet.mat;
result = net(inputs);
This how I'm calling from Java:
result = theNNet.compute(1,mWNumericArray);
I'm getting these warnings and exceptions:
{Warning: While loading an object of class 'nnetWeight':
Undefined function or method 'initzero' for input arguments of type 'char'.}
> In compute at 3
{Warning: While loading an object of class 'nnetWeight':
Undefined function or method 'initzero' for input arguments of type 'char'.}
> In compute at 3
{Warning: An error occurred when running a class's loadobj method. The object
that was loaded from the MAT-file was a copy of the object before the loadobj
method was run. The rest of the variables were also loaded from the MAT-file.
The encountered error was:
Reference to non-existent field 'net_read_only'.
}
> In compute at 3
{??? Undefined function or method 'initzero' for input arguments of type 'char'.
Error in ==> compute at 4
}
... Matlab M-code Stack Trace ...
file C:\Users\ULQUIO~1\AppData\Local\Temp\ulquiorra\mcrCache7.14\elabor1\elabora\compute.m, name compute, line 4.
com.mathworks.toolbox.javabuilder.MWException: Undefined function or method 'initzero' for input arguments of type 'char'.
at com.mathworks.toolbox.javabuilder.internal.MWMCR.mclFeval(Native Method)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.access$600(MWMCR.java:23)
at com.mathworks.toolbox.javabuilder.internal.MWMCR$6.mclFeval(MWMCR.java:902)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.mathworks.toolbox.javabuilder.internal.MWMCR$5.invoke(MWMCR.java:800)
at $Proxy0.mclFeval(Unknown Source)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.invoke(MWMCR.java:475)
at costmodelpkg.CostModel.viewforecasteddata(CostModel.java:218)
at testmatlab.Main.main(Main.java:41)
I can not solve this problem. How can I do? Can anyone help me? I decided to create the object network from the command line within the script, but I do not know how to do this. Help me, please!!!
P.S.: I use Matlab R2010B version.
0 Comments
Answers (1)
Laokine
on 1 Mar 2012
I have the same problem, and still can't find the solution on the web, help please, anybody?
0 Comments
See Also
Categories
Find more on Java Package Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!