필터 지우기
필터 지우기

Calling function to evaluate another called function - delimeter error

조회 수: 1 (최근 30일)
I have two functions:
  1. One for the Lee-Kesler state equation (name: lk)
  2. 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

채택된 답변

Walter Roberson
Walter Roberson 2021년 3월 9일
a = wn(@lk,6,10,5)
  댓글 수: 6
Walter Roberson
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)
Michael Jacobson
Michael Jacobson 2021년 3월 9일
@Walter RobersonAh that seems to have fixed the issue. Thank you very much for your help - I do appreciate it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by