Can't solve matrix dimension issue and define a variable.

조회 수: 6 (최근 30일)
Zain
Zain 2021년 5월 25일
댓글: Rena Berman 2021년 6월 29일
Hello,
Can someone help me, how can I remove matrix dimension issue. The error is ''Undefined function or variable y''.
I want to use y data which is a vector (line-146) and is obtained/calculated in line-134.
y is not declared and I want to create it in the main code while calling and receiving the function.
I would be thank ful if anyone can edit the attached code.
Thanks
  댓글 수: 2
Rik
Rik 2021년 6월 9일
The original question from the Google cache (without the attachment):
Can't solve matrix dimension issue and define a variable.
Hello,
Can someone help me, how can I remove matrix dimension issue. The error is ''Undefined function or variable y''.
I want to use y data which is a vector (line-146) and is obtained/calculated in line-134.
y is not declared and I want to create it in the main code while calling and receiving the function.
I would be thank ful if anyone can edit the attached code.
Thanks
Rena Berman
Rena Berman 2021년 6월 29일
(Answers Dev) Restored edit

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

답변 (2개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 5월 25일
Hi,
You need to pre-define y before x being computed. Otherwise, y can't be computed within your nested function.
  댓글 수: 2
Walter Roberson
Walter Roberson 2021년 5월 25일
The function basic is not a nested function, so it does not use shared variables.
The user needs to redefine function basic so as to pass in y.
Zain
Zain 2021년 5월 26일
Can you please do it, I tried but couldn't manage to implement it.
I'm a bit new to this.

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


Walter Roberson
Walter Roberson 2021년 5월 26일
Repaired function attached.
I also improved the main function so that x and y are returned if you assign the output of the function to something. For example
[x, y] = aaaaaa;

카테고리

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