Calling function to evaluate another called function - delimeter error
1 次查看(过去 30 天)
显示 更早的评论
I have two functions:
- One for the Lee-Kesler state equation (name: lk)
- One to find the root of an equation through the modified regular falsi method (name: wn). The inputs are (function to be evaluated, first root guess, second root guess, number of significant figures in final answer).
In a separate script, i am trying to call the mrf function to evaluate the lk equation as follows:
a=@wn(@lk,6,10,5)
However, when this is evaluated, I recieve the following error message:
Error: File: MainFunction.m Line: 51 Column: 18
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for
mismatched delimiters.
I am not sure what is causing this, nor how to remedy it.
Thank you
0 个评论
采纳的回答
Walter Roberson
2021-3-9
a = wn(@lk,6,10,5)
6 个评论
Walter Roberson
2021-3-9
function wn = wn(something)
end
That defines a function named wn but does not assign anything to the variable named wn
I suggest that you replace
function wn = wn(something)
end
%This is my function
function wn=mrf(f,a,b,n)
with
function Wn = wn(f,a,b,n)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 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!