Borrar filtros
Borrar filtros

Using an array as an output

5 visualizaciones (últimos 30 días)
amateurintraining
amateurintraining el 24 de Sept. de 2017
Respondida: Gaige el 5 de Oct. de 2023
I have a function and the output must be a one-dimensional array consisting of the elements y1, y2, y3, and y4.
Do I have to make a subfunction or nested function in order to define the output?
Simply writing
output=[y1 y2 y3 y4]
does not work.
  2 comentarios
per isakson
per isakson el 24 de Sept. de 2017
Editada: per isakson el 24 de Sept. de 2017
"Simply writing [...] does not work". If "the elements y1, y2, y3, and y4" are scalars I cannot see why it shouldn't work.
amateurintraining
amateurintraining el 24 de Sept. de 2017
It said that the variable is undefined. Maybe this is because it is an output?

Iniciar sesión para comentar.

Respuestas (1)

Gaige
Gaige el 5 de Oct. de 2023
I would need to see all the code to be sure. Did you try seperating the elements with a coma, and was output the return falue of the function?

Categorías

Más información sobre Loops and Conditional Statements 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