Simple question about defining function
조회 수: 9 (최근 30일)
이전 댓글 표시
I have a function like this:
function funs = test
funs.er=@er;
...
end
What that syntax means? My question is: How can I call "er" from funs?
댓글 수: 0
답변 (1개)
Ankriti Sachan
2020년 5월 12일
I think this answers your query best - https://www.mathworks.com/matlabcentral/answers/440767-how-do-i-call-a-function-within-another-function.
So, to call a function "er" from "funs", you can simply call it like:
er()
or
y=er(), if 'er' has a return value.
The syntax "@er" returns a handle to the 'er' function, which can be used in functions like 'integral,' etc.
You can read about function handles here- https://www.mathworks.com/help/matlab/matlab_prog/creating-a-function-handle.html.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!