Can't solve matrix dimension issue and define a variable.
Mostrar comentarios más antiguos
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 comentarios
Rik
el 9 de Jun. de 2021
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
el 29 de Jun. de 2021
(Answers Dev) Restored edit
Respuestas (2)
Sulaymon Eshkabilov
el 25 de Mayo de 2021
0 votos
Hi,
You need to pre-define y before x being computed. Otherwise, y can't be computed within your nested function.
2 comentarios
Walter Roberson
el 25 de Mayo de 2021
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
el 26 de Mayo de 2021
Walter Roberson
el 26 de Mayo de 2021
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;
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!