Borrar filtros
Borrar filtros

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

4 visualizaciones (últimos 30 días)
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 comentarios
Geoff Hayes
Geoff Hayes el 7 de Feb. de 2015
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?
Jan
Jan el 7 de Feb. de 2015
It depends on the contents of fun(), Without seeing the code, it is hard to guess an advice.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by