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 件)

Sean de Wolski
Sean de Wolski 2012 年 3 月 12 日

0 投票

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 ExchangeLoops 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