I am not able to run the loop
Ältere Kommentare anzeigen
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')
Antworten (1)
Roger Stafford
am 20 Mai 2016
0 Stimmen
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 Kommentare
Amit Chandrakar
am 20 Mai 2016
But I thought that since I put loop there, function will convert mi in to m1 or m2 ....
Roger Stafford
am 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.
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!