Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross 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
Aug 26, 2005
1
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??
 
Replies continue below

Recommended for you

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