How to transfer a function_handle vector to another function in matlab?

% I know I can pass a function handle as a parameter directly to another function Like this form below
f(@func)
% Now I want to pass a one-dimensional function handle vector directly
% what is the best way for me to achieve this?
vector_func=[@func1,@func2,@func3]
f(vector_func)
%I've tried using cell to store function handles, but it throws an error
vec = cell(2);
cell(1) = @func %it will throw an error say cannot convert from function_handle to cell

 채택된 답변

vector_func = {@func1,@func2,@func3};

댓글 수: 1

Yes, your suggestion is valid, I just tried it and found that cell reports an error because I was confusing cell() and cell{}.
Thanks for your help.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

제품

릴리스

R2022b

질문:

2023년 2월 12일

댓글:

2023년 2월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by