Integrate a trained neural network by matlab into java-Collection of common programming errors
I’m working on my final 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] = viewforecasteddata(newinputs)
%#function network
load('Test.mat','net');
result = net(newinputs);
end
This how I’m calling from Java:
result = theCost.viewforecasteddata(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 viewforecasteddata at 3
{Warning: While loading an object of class 'nnetWeight':
Undefined function or method 'initzero' for input arguments of type 'char'.}
> In viewforecasteddata 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 viewforecasteddata at 3
{??? Undefined function or method 'initzero' for input arguments of type 'char'.
Error in ==> viewforecasteddata at 4
}
... Matlab M-code Stack Trace ...
file C:\Users\knishe\AppData\Local\Temp\knishe\mcrCache7.14\costmo62\costmodelpkg\viewforecasteddata.m, name viewforecasteddata, 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)
BUILD SUCCESSFUL (total time: 8 seconds)