Plot GUI Color test
Afficher commentaires plus anciens
Réponses (1)
Ben Cunningham
le 9 Déc 2019
Each button has a property 'Background Colour'. You can use a simple state machine to set the colour in [Red, Green, Blue].
See the below code:
properties (Access = private)
ButtonState = 1; % Current Button State
end
% Callbacks that handle component events
methods (Access = private)
% Value changed function: Button
function ButtonValueChanged(app, event)
value = app.Button.Value;
switch app.ButtonState
case 1
app.Button.BackgroundColor = [1.00,0.00,0.00];
app.ButtonState = 2;
case 2
app.Button.BackgroundColor = [0.00,1.00,0.00];
app.ButtonState = 3;
case 3
app.Button.BackgroundColor = [0.00,0.00,1.00];
app.ButtonState = 1;
end
end
end
1 commentaire
Robin Stengl
le 9 Déc 2019
Catégories
En savoir plus sur App Building dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!