I am not able to run the loop

I am trying to do this,
m1=input('the value of m1 is')
m2=input('the value of m2 is')
x1=input('the value of x1 is')
x2=input('the value of x2 is')
y1=input('the value of y1 is')
y2=input('the value of y2 is')
for i=1:1:2
for j=1:1:2
[Xij,Yij]= Chandu(mj,mi,xj,xi,yj,yi)
end
end
%fucntions is
function[Xij,Yij]= Chandu(mj,mi,xj,xi,yj,yi)
Xij=((mj*xj);
Yij=((mj*yj);
end
Why I am geeting error whenever I am trying to run the program???? showing (Undefined function or variable 'mj')

Réponses (1)

Roger Stafford
Roger Stafford le 20 Mai 2016

0 votes

The error message correctly tells you what is wrong. The variables mi and mj have not been defined in your main program and the ‘Chandu’ function needs their values to be able to operate properly.

2 commentaires

Amit Chandrakar
Amit Chandrakar le 20 Mai 2016
But I thought that since I put loop there, function will convert mi in to m1 or m2 ....
Roger Stafford
Roger Stafford le 20 Mai 2016
No such luck! The quantities m1 and m2 were defined but mi and mj were not and those are quite different names. You should get used to paying more close attention to what error messages tell you.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by