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')
답변 (1개)
Roger Stafford
2016년 5월 20일
0 개 추천
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
Amit Chandrakar
2016년 5월 20일
But I thought that since I put loop there, function will convert mi in to m1 or m2 ....
Roger Stafford
2016년 5월 20일
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.
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!