MATLAB: Storing only part of the output of a function with multiple outputs

function with multiple outputsMATLAB

Suppose you have a function with many outputs, e.g.,
[C,ia] = setdiff(A,B)
I am only interested in ia and not C. Is there some way of only calling on ia without storing C? Thank you very much!

Best Answer

Use the tilde ‘~’ to suppress outputs you don’t need.
In this instance:
[~,ia] = setdiff(A,B)