Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)

Risposta accettata

Akshat
Akshat il 1 Ott 2023
Modificato: Akshat il 1 Ott 2023
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 Commenti
Akshat
Akshat il 2 Ott 2023
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 il 3 Ott 2023
Modificato: Fangjun Jiang il 3 Ott 2023
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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by