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')

Respuestas (1)

Roger Stafford
Roger Stafford el 20 de Mayo de 2016

0 votos

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 comentarios

Amit Chandrakar
Amit Chandrakar el 20 de Mayo de 2016
But I thought that since I put loop there, function will convert mi in to m1 or m2 ....
Roger Stafford
Roger Stafford el 20 de Mayo de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 20 de Mayo de 2016

Comentada:

el 20 de Mayo de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by