How can I use the ButtonGroup in AppDesigner?

9 次查看(过去 30 天)
Hello,
I haven't been working with the App Designer for very long and I currently have a proble. The point is that I want to create a ButtonGroup with 2 buttons. I created the callback function "ButtonGroupSelectionChanged", which creates "selectedButton = app.ButtonGroup.SelectedObject" for me. Now I would like to execute an action if button 1 is confirmed and execute a function if button 2 is confirmed.
How can I query this in the code? I am not sure what is in the variable selectedButton.
With a SwitchButton I solved it as follows (The two positions are called "active" and "inactive").
if strcmp(status, 'inactive')
app.Lamp_LEDoff.Color = 'red';
writeDigitalPin(app.a, 'D11',0);
elseif strcmp(status, 'active')
app.Lamp_LEDoff.Color = 'green';
end
Unfortunately, this does not work with a button.
It would be great if someone could help me!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by