Using an array as an output

조회 수: 5 (최근 30일)
amateurintraining
amateurintraining 2017년 9월 24일
답변: Gaige 2023년 10월 5일
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
per isakson
per isakson 2017년 9월 24일
편집: per isakson 2017년 9월 24일
"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 2017년 9월 24일
It said that the variable is undefined. Maybe this is because it is an output?

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

답변 (1개)

Gaige
Gaige 2023년 10월 5일
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?

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by