Hi, would someone be willing to assist me in resolving this error

조회 수: 2 (최근 30일)
Danikha Shyken
Danikha Shyken 2023년 9월 30일
편집: Fangjun Jiang 2023년 10월 3일

채택된 답변

Akshat
Akshat 2023년 10월 1일
편집: Akshat 2023년 10월 1일
I understand that you require assistance in resolving an error. I investigated the screenshots attached and observed that the error reflects an attempt to modify the value of a Simulink Input. I am assuming that you wish to overwrite the value of the variable 'selectedOutput' during simulation. To achieve this, you can leverage the 'assignin' function to assign the value in a specific workspace and allow the simulation to take the updated value from next time step.
In reference to the code attached, the variable 'selectedOutput' can be assigned through 'assignin' function as
% assuming that the variable is defined in the base workspace
assignin('base', 'selectedOutput', tegVoltageRange);
I hope this helps.
  댓글 수: 3
Akshat
Akshat 2023년 10월 2일
Great that it worked for you! If you could kindly mark it as accepted, it would be greatly appreciated. This way, if someone else encounters a similar issue, they can also benefit from this workaround.
Fangjun Jiang
Fangjun Jiang 2023년 10월 3일
편집: Fangjun Jiang 2023년 10월 3일
The error messages come from Stateflow. The OP must have defined those two variables as "input" data to the Stateflow but still try to assign values to those variables in the function (which must have been inside the Stateflow too), thus the error. A similar question has been asked by the OP and has been answered before.
'selectOutput' referenced by the error message points to the name of the function. 'selectedOutput' is a variable inside the function but does not involve any error. This mis-led to this answer that is irrevant to the error.
You seemed to struggle on the same issue for a long time but without making progress.
I suggest you clearly explain your original task or what you want without involving any Simulink model, because your model snip does not make sense and it is mis-leading.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by