Rewrite one Function with multiple output into several function with each one output!

4 次查看(过去 30 天)
Hi!
I am new here and I make my first experiences with MATLAB. I have one question about functions with multiple output arguments. If I have a function
[y1,y2,y3,y4,y5]=fun(x1,x2,x3,a,b,c,d)
Is it possible to exchange the this function with 5 functions like
y1=fun(x1,x2,x3,a,b,c,d)
y2=fun(x1,x2,x3,a,b,c,d)
y3=fun(x1,x2,x3,a,b,c,d)
y4=fun(x1,x2,x3,a,b,c,d)
y5=fun(x1,x2,x3,a,b,c,d)
I read about the subfunction, but my problem is that y5 can be calculated only if I have y4 and y3 and y3 and y4 only if I have y1 and y2. How do I manage such problem.
The reason for me is I want to run a loop on only one output.
Thanks
  2 个评论
Geoff Hayes
Geoff Hayes 2015-2-7
Antonio - if y3 and y4 depend on y1 and y2, then how can
y3=fun(x1,x2,x3,a,b,c,d)
occur if you don't pass in y1 and y2? Or are you assuming that the code will go "further" and know that it is supposed to output y3 and so first calculates y1 and y2?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by