Creating a Responsive GUI Within Simulink
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Luke Dillon
il 5 Set 2018
Commentato: Luke Dillon
il 6 Set 2018
Hi All,
I recently made a small app in App Designer where the user could provide inputs via switches/buttons, and a number of responses could be observed.
Some of these responses were a lamp changing colour from red to green, some were text changing from grey to red, and some were a textbox/area becoming visible/invisible for example.
I am now attempting to recreate the same app using Simulink and Stateflow, as Stateflow allows for more efficient behavioural modelling.
For the GUI I've used dashboard blocks (lamps, text areas etc.) and for the lamps changing colour, it's as simple as connecting them to the right output from the model.
However, I'm struggling to find a way to get text to change colour in response to a signal, or for an area to appear/disappear, etc. For example, say I've got a line of text that says 'WARNING', and it starts greyed out. I'd like it to turn bright red when the user presses a certain Dashboard button/switch.
In App Designer I was able to do this using callbacks, and I'm just wondering if anyone knows the method for doing the same in Simulink?
Many thanks!
0 Commenti
Risposta accettata
Sara Nadeau
il 5 Set 2018
Hi Luke,
What version of MATLAB/Simulink are you using? I think there are a couple blocks that could help you.
If your version is R2016b or later, you could use the MultiStateImage block as a responsive indicator. You would connect the MultiStateImage block to the signal you want to control its state and you could upload an image for each state. For example, the image could be of the text you want to display (WARNING) in different colors, depending on the state. The MultiStateImage block works very similarly to the Lamp block while allowing much greater control over the appearance.
If your version is R2017b or later, you can call a callback function from your dashboard with the Callback Button block. A callback function that you specify in the block dialog executes when you press the button. You can define separate functions for a 'click' (short press) and a 'press' (holding the button for an amount of time you specify).
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Dashboard 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!