Don't understand my error mention

2 次查看(过去 30 天)
Karel
Karel 2012-8-2
I get the folowing error mention:
Error in ==> trapezes at 3
if(n<1)
??? Output argument "Itr" (and maybe others) not assigned during
call to "C:\Users\Lerak\Documents\MATLAB\trapezes.m>trapezes".
Error in ==> principal_1 at 45
poidstra=trapezes(o);
Could somebody explain me what this really means?

回答(1 个)

Kevin Claytor
Kevin Claytor 2012-8-2
Can you post the code to trapezes - the error message says the problem is in there, you have something like;
function Itr=trapezes(n)
if n<1
Itr = 5;
end
end
The problem here is that if n > 1, there is no case that assigns Itr, so there is no output variable. You could use;
function Itr=trapezes(n)
Itr=0;
if n<1
Itr = 5;
else
Itr = 1;
end
end
Now you have a success case, a fail case, and a default case that you can check against.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by