How do you write a function that can take another function as an argument?
조회 수: 1 (최근 30일)
이전 댓글 표시
How do you write a function that can take another function as an argument?
This is pseudocode for what I want to write:
function [outputvector] = myfunction(inputfunction, myvector, arg 2, arg3,..., argn)
for i = 1:length(myvector) outputvector (i) = inputfunction(myvector(i), arg2, arg3, ...argn) end
Thanks.
댓글 수: 0
답변 (2개)
Vishal Rane
2012년 11월 8일
편집: Vishal Rane
2012년 11월 8일
If you are not used to function handles, you can simply pass the function name and feval it inside. As long as both functions are anywhere on the matlab path.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!