필터 지우기
필터 지우기

Evaluating a function, variable not defined

조회 수: 1 (최근 30일)
Gavin Seddon
Gavin Seddon 2015년 9월 8일
답변: Gavin Seddon 2015년 9월 9일
hello, I am trying to evaluate a function but I receive an error. Will someone please help? My error is
y = feval(minusF,x)
Undefined function or variable 'x'.
thanks.

채택된 답변

Stephen23
Stephen23 2015년 9월 8일
편집: Stephen23 2015년 9월 8일
You have not defined any variable named x.
It is like you call this:
sin(x)
but have not specified x anywhere. MATLAB does not invent values to use, it uses the values that you have defined, or else it throws an error. In this case, because you have not defined any variable x, it throws an error.
But really you should avoid using feval and use function handles instead. These are more robust, are much neater, and allow you to use the standard editor code hinting and debugging tools.

추가 답변 (1개)

Gavin Seddon
Gavin Seddon 2015년 9월 9일
Thanks.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by