user interface - Detect no.of Button clicks Matlab Gui -
is there way detect no.of times button clicked in matlab gui? new this, appreciated.
here's example. uses button's 'userdata' property hold counter. old syntax (pre-r2014b) used getting , setting properties:
h = uicontrol('style', 'pushbutton', 'string', 'push me'); %// create button set(h, 'userdata', 0); %// initiallize counter set(h, 'callback', 'set(gcbo,''userdata'',get(gcbo,''userdata'')+1)'); %// increase counter now click several times on button, , number of clicks with
get(h, 'userdata')
Comments
Post a Comment