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