Undefined Function error (Undefined)

1 回表示 (過去 30 日間)
adam
adam 2014 年 8 月 12 日
コメント済み: Sara 2014 年 8 月 12 日
Hi there,
It is my function:
function [y, cons] = TMS_CONSTR_objfun(x)
y = [0 0];
cons = [];
x(1:10)=1;
d(1:10)=0;
sp(1:10)=0;
y(1)=sum(x(1:10));
for h=1:10
d(h)=x(h)*xe(h);
sp(h)=x(h)*ve(h);
end
dd=d(d~=0);
spp=sp(sp~=0);
n=length(dd);
for j=2:n-1 y(2)=abs(((dd(1)+dd(2))/(2*spp(1)))+9.7-((x(n)+x(n-1))/(2*spp(n))+ sum((x(j+1)-x(j-1))/(2*spp(j))))); end
xe and ve are variables that imported from excel. I keep receive this error:
Undefined function 'xe' for input arguments of type 'double'. and
Undefined function or variable 'x'.
Please help. Thanks
  1 件のコメント
Sara
Sara 2014 年 8 月 12 日
xe and ve are not defined anywhere in this function. If you import them in another function, you have to pass them to this function. for x: how do you call this function?

サインインしてコメントする。

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 8 月 12 日
xe is used inside your function and can not be recognized even if it exist in the Matlab workspace. You need to declare it as input argument

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by