Assign workspace variable during runtime

5 Ansichten (letzte 30 Tage)
Thomas Schütz
Thomas Schütz am 28 Okt. 2020
Beantwortet: Rishabh Mishra am 4 Nov. 2020
Hello everybody,
I want to change a Variable from Simulink Workspace during runtime through a Matlab function. Does anyone know how to implement this ?
Thanks in advance,
Thomas
  2 Kommentare
Fangjun Jiang
Fangjun Jiang am 28 Okt. 2020
What do you mean by "Simulink Workspace"?
Thomas Schütz
Thomas Schütz am 28 Okt. 2020
The Simulink Model Explorer. I assigned my variable in the Model Workspace.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Rishabh Mishra
Rishabh Mishra am 4 Nov. 2020
Hi,
You may use the MATLAB Function Block available in Simulink. Double click on the scenario canvas and type ‘MATLAB Function’ and then select the first block in the search list. On double clicking on the MATLAB Function Block, you can define the required function in MATLAB script editor.
Use the 'Constant block' in Simulink with it's value as workspace variable along with the MATLAB Function block to process the workspace variable during simulation runtime.
For better understanding of the MATLAB function block, refer the following link:
Hope this helps.

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by