function x=solv(a,b) while round((a*x-1)/b)~=(a*x-1)/b x=x+1; end this function is showing error while running: ??? Undefined function or method 'solv' for input arguments of type 'double'. please help me to solve this problem..
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
function x=solv(a,b)
while round((a*x-1)/b)~=(a*x-1)/b
x=x+1;
end
above function is showing error while running: ???
Error is: Undefined function or method 'solv' for input arguments of type 'double'.
please help me to solve this problem...
댓글 수: 0
답변 (2개)
Wayne King
2013년 8월 4일
The error message your getting is because solv.m is not in a folder (directory) on the MATLAB path.
Let's say that you have your solv.m in a folder called c:\mfiles. You must do the following, either:
>>addpath 'c:\mfiles'
or enter
>>pathtool
and add the folder using the UI.
If you have done it successfully, you should be able to enter:
>>which solv.m
and get the path back to your M-file returned.
However, even then your function will error:
Your while statement references a variable, x, but you never define x in your function prior to using it, nor do you pass x as an input to the function.
The function will error saying that x is undefined
댓글 수: 0
Azzi Abdelmalek
2013년 8월 4일
In this line
while round((a*x-1)/b)~=(a*x-1)/b
What is the value of x? your code is supposed to calcul x
댓글 수: 0
이 질문은 마감되었습니다.
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!