not enough input arguments

3 Ansichten (letzte 30 Tage)
kiruba bagirathi
kiruba bagirathi am 2 Dez. 2014
Kommentiert: Jan am 2 Dez. 2014
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 Kommentare
Julia
Julia am 2 Dez. 2014
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 am 2 Dez. 2014
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by