Can an anonymous function contain multiple output arguments?
2 answers
When the expression that your anonymous function is executing can return more than one value, then your anonymous function can be. For example, using the max function , which can return both the maximum value of an array and its index:
arr = [1 2 4 3]; anon = @(y) max(y); [maxVal, ind] = anon(arr);
+7
source to share