How do I change the value of a previous state button to 0 when a new one (out of 10) is pressed?

3 views (last 30 days)
I have 10 state buttons but I only want 1 to be true at a time (so they work like radio buttons). The activation of a button should turn any previous one to false.

Accepted Answer

Kevin Holly
Kevin Holly on 19 Jul 2022
Barney,
See app attached.
  3 Comments
Kevin Holly
Kevin Holly on 20 Jul 2022
The app here is different from the one found here:
I answer this question afterwards. I modified the following:
methods (Access = public)
function func(app,hObject)
if hObject.Value==1
app.Button.Value=0;
app.Button2.Value=0;
app.Button3.Value=0;
app.Button4.Value=0;
app.Button5.Value=0;
app.Button6.Value=0;
app.Button7.Value=0;
app.Button8.Value=0;
app.Button9.Value=0;
app.Button10.Value=0;
app.Button.Text = 'Connect';
app.Button2.Text = 'Connect';
app.Button3.Text = 'Connect';
app.Button4.Text = 'Connect';
app.Button5.Text = 'Connect';
app.Button6.Text = 'Connect';
app.Button7.Text = 'Connect';
app.Button8.Text = 'Connect';
app.Button9.Text = 'Connect';
app.Button10.Text = 'Connect';
hObject.Value=1;
hObject.Text = 'Connecting...';
else
hObject.Text = 'Connect';
end
end
end

Sign in to comment.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!