Check if requested output is ~

Hi,
Is there a way to check if a requested output is ~ ?
Let's say I have a function:
function [ out1, out2, out3 ] = myFunction( input )
that I am calling from: [ a, ~, b ] = myFunction( c );
Is there a way to see, inside myFunction, that out2 is not requested? I want to only compute requested outputs, that may or may not be the last output (i.e. I cannot use nargout to just count the number of arguments).
Thank you

Answers (1)

No.
I would recommend having your function accept an additional input argument that tells you which outputs are filled.
[out1, ~, out2] = fun(x,y,[1 3]) %outputs 1 and 3 requested.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Asked:

on 12 Mar 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!