Undefined function or variable "Horz_average_l"
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Tan Phan
am 28 Nov. 2014
Kommentiert: Tan Phan
am 2 Dez. 2014
I read many answers for question: Undefined function or variable in forum, and check with my code, but i have not repaired that error. Can u see to help me?
function[Horz_average_l,Horz_average_r]= Horz_avg(Start,End,side) Sum =0; ITERATIONS = 200;
syms i j side Start End
switch side case 1
for j=0: (ITERATIONS-1),
for i=Start(j): (Start(j)+End(j))/2-1
Sum = Sum + BWPic(i,j);
end
Horz_average_l(j)= Sum/((End(j) - Start(j))/2); %Left side only */
Sum = 0;
end
case 2
for j=0:(ITERATIONS-1)
for i=((Start(j)+End(j))/2) : (End(j)-1)
i = i +1;
Sum = Sum + BWPic(i,j);
end
Horz_average_r(j)= Sum/((End(j) - Start(j))/2); % Right side only
Sum = 0;
end
end
for j = 0 : (ITERATIONS-4)
if Horz_average_l(j+1) >=Horz_average_l(j) && Horz_average_l(j+2) < Horz_average_l(j+1) && Horz_average_l(j+3) >= Horz_average_l(j+2)
end
end
error in the last if
Undefined function or variable "Horz_average_l".
0 Kommentare
Akzeptierte Antwort
Thorsten
am 28 Nov. 2014
Bearbeitet: Thorsten
am 28 Nov. 2014
The last if seems to have no body.
Please format all your code.
Why do you use
syms i j side Start End
Where is PWPic defined?
And what is the function exactly supposed to do?
3 Kommentare
Thorsten
am 28 Nov. 2014
I still do not understand why you need to use symbolic variables i j side Start End
How are Start and End defined?
What is the function supposed to do?
You have defined Start and End as arguments of your function. So you have to pass them when you call the function. Otherwise you get the "Not enough input arguments."
So you should have defined Start and End outside your function and then call is like
mystart = ... % whatever your variable is defined
myend = ...
[hl hr] = Horz_avg(mystart,myend,1);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Assumptions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!