Multi output function as input

조회 수: 9 (최근 30일)
Corrado
Corrado 2011년 12월 15일
Hi, I have a function test that has four input. Than I have another one function daisy that has three outputs. How may I do something like
>>test(dasy,X);
where the outputs of daisy is correct as first three input of test and X is a correct input as last input of test? I tried but it doesn't work and say that I didn't pass the third input argument (I think because daisy pass only his first output to test...).
thank you everyone.

답변 (1개)

Walter Roberson
Walter Roberson 2011년 12월 15일
In MATLAB, it cannot be done in one step. You must assign the output of daisy to one or three variables.
[d1, d2, d3] = daisy();
test(d1, d2, d3, X)
OR
[d{1:3}] = daisy();
test(d{:}, X)
  댓글 수: 2
Corrado
Corrado 2011년 12월 16일
Ok, I was worried about it...so MatLab cannot, in any way, produce that result without putting any variable in the main workspace...(other than create another m.files with all the code lines)
thank you
Walter Roberson
Walter Roberson 2011년 12월 16일
Right there isn't any way. Of course you can clear the temporary variable right after you use it.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by