Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Registering Button clicks in MatLab GUI

Status
Not open for further replies.

neuroscience

Bioengineer
Joined
Aug 26, 2005
Messages
1
Location
US
I have a GUI with 8 push-buttons and I need to count which button was clicked and the order this clicking occured. Additionally, I need the GUI to reset after n amount of clicks occured. Any suggestions??
 
Add a variable to the figure's 'User' property called eg "counter".

when you set up the GUI set this value to zero.
eg,
counter = 0;
set(gcf,'User', counter);

Then in the callback for each button put in lines something like
Code:
counter = get(gcf, 'User')
counter = counter+1;
if counter == 8
   %code to reset GUI here
   counter == 0;
end
set(gcf, 'User', counter);
M

--
Dr Michael F Platten
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top