MATLAB: Matlab return the output of wrong function

function call

Hi fellows,
I have encounted a super weird situation. I will try to explain it clearly.
I have defined several function, one of them is called maxmin.m. And this function would call another function called maxmin0. But when i call the function maxmin, the result is always the result from the function maxmin0. I don't know where is the problem. Becasue maxmin.m return the proper result when I test it by get rid of function form and run it as a normal .m file.
Please help me about this. This is the code for maxmin.m
if true
%
function [ PF ] = maxmin(sub,DD) %risk parameter and low bounds
d1=DD(:,1:3)-1;
d2=DD(:,4:6)-1;
edw=DD(:,7);
rn=size(d1,1);
lb1=sub(1);
lb2=sub(2);
lb3=sub(3);
r=sub(4);
[PF0,eu0]=maxmin0(sub,DD);
[PF1,eu1]=maxmin1(sub,DD);
[PF2,eu2]=maxmin2(sub,DD);
[PF3,eu3]=maxmin3(sub,DD);
[PF4,eu4]=maxmin4(sub,DD);
[PF5,eu5]=maxmin5(sub,DD);
[PF6,eu6]=maxmin6(sub,DD);
for i=1:rn
eutotal(i,:)=[eu1(i);eu2(i);eu3(i);eu4(i);eu5(i);eu6(i)];
if (0<=PF0(i,1))<=edw(i) && 0<=PF0(i,2)<=edw(i)
PF(i,:)= PF0(i,:);
else
if(eu1(i)==max(eutotal(i)))
PF(i,:)=PF1(i,:);
elseif(eu2(i)==max(eutotal(i)))
PF(i,:)=PF2(i,:);
elseif(eu3(i)==max(eutotal(i)))
PF(i,:)=PF3(i,:);
elseif(eu4(i)==max(eutotal(i)))
PF(i,:)=PF4(i,:);
elseif(eu5(i)==max(eutotal(i)))
PF(i,:)=PF5(i,:);
elseif(eu6(i)==max(eutotal(i)))
PF(i,:)=PF6(i,:);
end
end
end
end
end

Best Answer

Perhaps it is because you seem to type with so many errors that it doesn't know whether you mean maxmim, maxmin1, or maxmim1 - all of which you referred to. In addition you misspelled "weird" as "wired", "don't" as "dont", and "because" as "becasue", so I don't have any confidence that you aren't continuing your history of typographical errors in your code. Please make sure everything in your code is spelled exactly as it should be.