From: Praveen on 3 Feb 2010 06:27 Dear all Please let me know how to exit from a loop using pushbutton in matlab gui? Thanks Praveen
From: Jos (10584) on 3 Feb 2010 07:17 Praveen <praveenmn1(a)gmail.com> wrote in message <5a21b456-6b0d-4100-9795-34956947cae8(a)k5g2000pra.googlegroups.com>... > Dear all > > Please let me know how to exit from a loop using pushbutton in matlab > gui? > > Thanks > Praveen Something along these lines: % create a figure with a button figure ; ButtonHandle = uicontrol('style','push',... 'callback','set(gcbo,''userdata'',1,''string'',''DONE!'')', ... 'userdata',0) ; % while loop n = 1 ; while(1) n = n + 1 ; set(ButtonHandle,'string',sprintf('%d',n)) ; pause(0.1) if get(ButtonHandle,'userdata'), break ; end end hth Jos
|
Pages: 1 Prev: delete rows/columns Next: Help incrementing slider over time in matlab gui tia sal22. |