i need a help to call pre trained neural network from Java
Show older comments
hi, i need a help, i'm loading a matlab pre trained neural network from Java via the following function
function [result] = viewforecasteddata(newinputs)
%#function network
load('Test.mat','net');
result = net(newinputs);
end
but when i calling from java:
result = theCost.viewforecasteddata(1,mWNumericArray);
it throws some exception in java while i'm calling:
{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
{??? Index exceeds matrix dimensions.
Error in ==> viewforecasteddata at 4
}
... Matlab M-code Stack Trace ...
file C:\Users\knishe\AppData\Local\Temp\knishe\mcrCache7.14\costmo66\costmodelpkg\viewforecasteddata.m, name viewforecasteddata, line 4.
com.mathworks.toolbox.javabuilder.MWException: Index exceeds matrix dimensions.
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:44)
please help me.... i'm reaching the deadline of my final project..
Answers (1)
Kaustubha Govind
on 4 May 2011
0 votes
This issue seems related to the one reported on http://www.mathworks.com/matlabcentral/answers/2420-loading-mat-file-problem.
Please contact Tech Support and ask for a resolution w.r.t. Solution#1-DRA5CA.
Categories
Find more on Call Java from MATLAB 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!