필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to deliver a few calculated results from a function to another function in order to perform further calculation

조회 수: 1 (최근 30일)
Dear All,
Thanks for your time.
I would like to deliver a few results from one subfunction to a main function in order to carry out more calculation. However, I have always got an error message wich indicates that multiple values cannot be assigned. the sample example is: function [a b c]=d a=3 b=4 c=5 end
function [a b c]=g a=6 b=7 c=8 end
function [e f]=h for i=1:2 [a{1} b{1} C{1}]=d [a{2} b{2} C{2}]=g e=a+b f=c*1 end end
Apparently the function d and g can only deliver value a, even though b and c are both included in the functions.
How could I carry out this?
Thanks very much.
  댓글 수: 1
Matt Kindig
Matt Kindig 2013년 1월 11일
How are you calling your function? Are you calling it from your main m-file (or from the command line) as:
[a b c]= g();
?

답변 (1개)

Sean de Wolski
Sean de Wolski 2013년 1월 11일
  댓글 수: 3
Sean de Wolski
Sean de Wolski 2013년 1월 11일
If you run that at the command line it will bring up the documentation for function. The doc is very helpful and provides many examples on how to use functions effectively.
zhe li
zhe li 2013년 1월 11일
Hi Sean, I have looked at the doc function. First, my function is setting up slight different than the example function as there is no input required in the function. The output only delivers the solution from 'ans' rather than defined a, b and c. Would you mind to have a look the sample I put on and see what the problem is?
Thank you very much.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by