MATLAB: Execute a list of functions

functionloopMATLAB

How do I store a list of user-defined function in an array and execute it in a loop one by one?
[d] = func1(a),
[e] = func2(b),
[f] = func2(c) ...

Best Answer

myfun = {@func1, @func2, @func2} ;
vars = {a, b, c};
for K = 1 : length(myfun)
result{K} = myfun{K}(vars{K});
end