Azzera filtri
Azzera filtri

gui-simulink how to change parameters

18 visualizzazioni (ultimi 30 giorni)
Ong Chong Jie
Ong Chong Jie il 12 Lug 2019
Risposto: Abhilash Padma il 17 Lug 2019
Hello, i am assigned to do the following task but i am new to MatLab..
Create and launch a GUI when 'run' is pressed on simulink. The user will enter the desired input value on the GUI.The input value will change accordingly on the simulink.
For example, the user want to have 1Volt for the simulation, he will enter '1' on the GUI and the simulink parameter will change accordingly.
I have a constant block, a repeating sequence interpolateed block and a compare to constant block. I have to edit these 3 block using GUI.
Any suggestions? Thanks in advance!

Risposte (1)

Abhilash Padma
Abhilash Padma il 17 Lug 2019
Hi,
I understand that you want to create a GUI to change the value of the block parameters in simulink.
You can do this by creating an app in app designer with Edit Field components.
In the “ValueChangedFcn” of Edit Field components, you can use set_param function to set the value of your required Simulink block.
The syntax of set_param function is as follows,
set_param(modelName/BlockName, BlockParameterName, value);
If you want to launch the app after loading the model, app need to be launched from “PostLoadFcn” callback or else if you want to launch the app after hitting the “run” button, app need to be launched from “StartFcn” callback. You can find the callbacks in Model Properties.
For more information, refer the following links:

Categorie

Scopri di più su Simulink Functions 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