I have a function that takes an image as an argument and produces a label and a score as a result. I occasionally want to quickly test over a (cell) array of images, and the most convenient way I know to do this is using arrayfun. This works fine for getting the labels my function produces, but I would really like the output to be a list of [label score] cells.
I could write a wrapper around my function that captures both values and returns them as a cell matrix, and then call that wrapper within arrayfun, but it seems like this is a common enough idiom that there should be a way to work with multiple return values more conveniently. Is there? (Perhaps a standard convenience function already exists that can do this? Sort of like the opposite of deal…)
You can get your output as two matrices by using built-in syntax:
For example:
And then run the function :