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

回答(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.

类别

帮助中心File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

提问:

2012-3-12

Community Treasure Hunt

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

Start Hunting!

Translated by