通过matlab将训练好的神经网络集成到java中

时间:2011-05-04 05:24:55

标签: java matlab neural-network

我正在完成我的最后一年项目。我需要从Java加载Matlab神经网络。

这是我为加载神经网络而创建的方法:

     function [result] =  viewforecasteddata(newinputs)
     %#function network 
     load('Test.mat','net');
     result = net(newinputs);

这是我从Java调用的方式:

    result = theCost.viewforecasteddata(1,mWNumericArray);

我收到了这些警告和例外情况:

{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)

0 个答案:

没有答案