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..
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
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...
Respuestas (2)
Wayne King
el 4 de Ag. de 2013
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
Azzi Abdelmalek
el 4 de Ag. de 2013
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
La pregunta está cerrada.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!