首先贴上我的.m文件,很简单:
function y=h1(a,b)
y = a+b;
end
使用的matlab版本是R2010b,前序的步骤基本上都验证没有错,然后贴上我的java程序代码,也很简单:
package com.test;
import com.mathworks.toolbox.javabuilder.MWException;
import flying.fly;
public class test {
public static void main(String[] args) throws MWException{
System.out.println("test begin!");
fly f = new fly();
System.out.println("test result is:"+f.h1(3,6));
}
}
但是运行之后就出现了如下的错误:
test begin!
{??? Error using ==> h1
Too many output arguments.
}
Exception in thread "main" ... Matlab M-code Stack Trace ...
com.mathworks.toolbox.javabuilder.MWException: Error using ==> h1
Too many output arguments.
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 flying.fly.h1(fly.java:196)
at com.test.test.main(test.java:11)
梵蒂冈之花
守着一只汪
相关分类