How to elegantly ignore some return values of a MATLAB function

With MATLAB Version 7.9 (R2009b) you can use a ~, e.g.,

[~, ~, variableThatIWillUse] = myFunction();

Note that the , isn’t optional. Just typing [~ ~ var] will not work, and will throw an error.

See the release notes for details.

Leave a Comment