Don't understand my error mention

2 Ansichten (letzte 30 Tage)
Karel
Karel am 2 Aug. 2012
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?

Antworten (1)

Kevin Claytor
Kevin Claytor am 2 Aug. 2012
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.

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by