Possible Duplicate:
Skipping outputs with anonymous function in MATLAB
Say I have a MATLAB function that returns two arguments:
[A,B] = twoArgsBack(x)
I want to write an anonymous function that uses B (e.g. for passing to a minimization routine)
myfun = @(x) sum(twoArgsBack(x))
will return the sum of A, ignoring the output from B. How can I write an anonymous function that returns the sum of B?