Hi, I am new to Matlab, When I try to run this in my main program it says not enough input arguments.
function [fun,grad]=myobjfun1_vers5(X,X1,JS_X1,l,k,I)
X=rand(34,3);
A1=norm(X*transpose(X)-X1*transpose(X1),'fro')^2;
A2=norm(X*transpose(X)-JS_X1*transpose(JS_X1),'fro')^2;
fun=(l-k)+1/2*(A1+A2);
if nargout>1
grad=(X*transpose(X)-X1*transpose(X1))+(X*transpose(X)-JS_X1*transpose(JS_X1));
end
Can you help to come out of this problem? The inputs are all matrices.

댓글 수: 2

Julia
Julia 2014년 12월 2일
How do you call your function in the main program? I guess you don't use enough input arguments doing it.
Why do you put X as input argument when your first action is to compute X as a random generated matrix?
Jan
Jan 2014년 12월 2일
Please format the code using the "{} Code" button in the future.
For an efficient help a copy of the complete error message is required. Most of all it contains the failing line. Currently we can only guess which line causes the error.
Please add the additional information by editing the question, not inside a comment. Thanks.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

질문:

2014년 12월 2일

댓글:

Jan
2014년 12월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by