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

Antworten (1)

Sean de Wolski
Sean de Wolski am 12 Mär. 2012

0 Stimmen

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.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 12 Mär. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by