How to create a vector of handle functions?

20 views (last 30 days)
I recently a had a problem , i wanted to create a vector of handle functions like
functions=[@(t)(t) @(t)(exp(t))]
How cn i do this ?

Accepted Answer

Steven Lord
Steven Lord on 1 Feb 2019
Store your function handles in a cell array.
f = {@(t) t, @(t) exp(t), @exp} % the second and third are equivalent
valueOfSecondFunction = f{2}(0:2)

More Answers (0)

Categories

Find more on Function Handles in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!