{"id":1891,"date":"2022-08-30T15:20:18","date_gmt":"2022-08-30T15:20:18","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/02\/integrate-a-trained-neural-network-by-matlab-into-java-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:20:18","modified_gmt":"2022-08-30T15:20:18","slug":"integrate-a-trained-neural-network-by-matlab-into-java-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/integrate-a-trained-neural-network-by-matlab-into-java-collection-of-common-programming-errors\/","title":{"rendered":"Integrate a trained neural network by matlab into java-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m working on my final year project. I need to load Matlab neural network from Java.<\/p>\n<p>This is the method I have created to load the neural network:<\/p>\n<pre><code>     function [result] =  viewforecasteddata(newinputs)\n     %#function network \n     load('Test.mat','net');\n     result = net(newinputs);\n<\/code><\/pre>\n<p>end<\/p>\n<p>This how I&#8217;m calling from Java:<\/p>\n<pre><code>    result = theCost.viewforecasteddata(1,mWNumericArray);\n<\/code><\/pre>\n<p>I&#8217;m getting these warnings and exceptions:<\/p>\n<pre><code>{Warning: While loading an object of class 'nnetWeight':\nUndefined function or method 'initzero' for input arguments of type 'char'.} \n&gt; In viewforecasteddata at 3\n{Warning: While loading an object of class 'nnetWeight':\nUndefined function or method 'initzero' for input arguments of type 'char'.} \n&gt; In viewforecasteddata at 3\n{Warning: An error occurred when running a class's loadobj method. The object\nthat was loaded from the MAT-file was a copy of the object before the loadobj\nmethod was run. The rest of the variables were also loaded from the MAT-file.\nThe encountered error was:\nReference to non-existent field 'net_read_only'.\n} \n&gt; In viewforecasteddata at 3\n{??? Undefined function or method 'initzero' for input arguments of type 'char'.\n\nError in ==&gt; viewforecasteddata at 4\n\n\n} \n... Matlab M-code Stack Trace ...\nfile C:\\Users\\knishe\\AppData\\Local\\Temp\\knishe\\mcrCache7.14\\costmo62\\costmodelpkg\\viewforecasteddata.m, name viewforecasteddata, line 4.\ncom.mathworks.toolbox.javabuilder.MWException: Undefined function or method 'initzero' for input arguments of type 'char'.\n        at com.mathworks.toolbox.javabuilder.internal.MWMCR.mclFeval(Native Method)\n        at com.mathworks.toolbox.javabuilder.internal.MWMCR.access$600(MWMCR.java:23)\n        at com.mathworks.toolbox.javabuilder.internal.MWMCR$6.mclFeval(MWMCR.java:902)\n        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\n        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\n        at java.lang.reflect.Method.invoke(Method.java:597)\n        at com.mathworks.toolbox.javabuilder.internal.MWMCR$5.invoke(MWMCR.java:800)\n        at $Proxy0.mclFeval(Unknown Source)\n        at com.mathworks.toolbox.javabuilder.internal.MWMCR.invoke(MWMCR.java:475)\n        at costmodelpkg.CostModel.viewforecasteddata(CostModel.java:218)\n        at testmatlab.Main.main(Main.java:41)\nBUILD SUCCESSFUL (total time: 8 seconds)\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-12-02 21:11:50. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;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(&#8216;Test.mat&#8217;,&#8217;net&#8217;); result = net(newinputs); end This how I&#8217;m calling from Java: result = theCost.viewforecasteddata(1,mWNumericArray); I&#8217;m getting these warnings and exceptions: {Warning: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1891","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1891","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1891"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1891\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}