Say I want to create an anonymous function from a m-file-function that returns two outputs. Is it possible to set up the anonymous function such that it only returns the second output from the m-file-function?
Example: ttest2
returns two outputs, t/f and a probability. If I want to use the t-test with cellfun
, I might only be interested in collecting the probabilities, i.e. I'd like to write something like this
probabilities = cellfun(@(u,v)ttest2(u,v)%take only second output%,cellArray1,cellArray2)