I have a certain function, say myFunc, that has an argument, say funcHandleArg, that should be a function_handle instance. However, this argument is not restricted to be one function_handle, but may in fact be a set of function_handles. Because Matlab does not accept non-scalar arrays of function handles [func_handle1, func_handle2], I must pass this argument as a cell array of function_handles {func_handle1, func_handle2}.
Now, my question is, how do I make sure that both funcHandleArg = func_handle1 and funcHandleArg = {func_handle1, func_handle2} are validated and accepted as input arguments. Summarising, I'd like something like this:
function output = myFunc(funcHandleArg, someOtherStuff)
arguments
funcHandleArg function_handle "AND cells of function_handles"
someOtherStuff otherStuff
end
output = someFunctionOf(funcHandleArg, someOtherStuff)
end
iscellandisa(funcHandleArg,'function_handle')to determine what type of variable you have. - Davidcellor afunction_handle. However, this does not solve my problem, because: 1) I don't check whether my argument is a cell offunction_handles 2) I don't have the easy-looking one-liner in theargumentsblock. - Sam