matlab 函数问题
出现的问题如下:
??? Undefined command/function 'eff'.
Error in ==> getbest at 5
lbest(M+1)=eff(1,M+1);
Error in ==> main at 41
[lbest,gbest]=getbest(pop,popsize,M,lbest,gbest);
下面是计算eff的函数
function eff=evaluation(pop,popsize,M,x,y,threshold,span,vr)
eff=zeros(popsize,M+1); %初始化eff
我在另外一个evaluation.m文件中编写了如何求取eff函数,并且在main.m主程序中写了如下循环
while(t<tt)
[pop,v]=pso(pop,popsize,M,bounds,vmax,v,lbest,gbest);
eff=evaluation(pop,popsize,M,x,y,threshold,span,vr);
[lbest,gbest]=getbest(pop,popsize,M,lbest,gbest);
t=t+1;
end
为什么还是报错没有定义呢?恳请大家帮忙解答,分数不够我再加,已经困扰我好几天了
[解决办法]
matlab的错误提示是我见过最好的了
??? Undefined command/function 'eff'.
Error in ==> getbest at 5
lbest(M+1)=eff(1,M+1);
Error in ==> main at 41
[lbest,gbest]=getbest(pop,popsize,M,lbest,gbest);