Effacer les filtres
Effacer les filtres

Don't understand my error mention

5 vues (au cours des 30 derniers jours)
Karel
Karel le 2 Août 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?

Réponses (1)

Kevin Claytor
Kevin Claytor le 2 Août 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.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by