user interface - Variabile behaving differently in debugging vs. non-debugging in Matlab? -
i work gui matlab r2014a.
i want see if there written in edit control. if is, program something. if not, else. code wrote (in keypressfcn callback):
h1=findobj('tag','btnok1'); %this button h2=findobj('tag','edindexiesire'); %this edit text=get(h2,'string'); %i read content of edit msgbox(text); %display in message box if (isempty(text)) %if edit empty... set(h1,'enable','off'); %... disable button. else %if not... set(h1,'enable','on'); %... enable button end
so far good. however, value of text variable seem different when debugging vs. when running program itself. in debug mode, works fine , text variable gets value typing keyboard. when not debugging, text variable takes value had previous iteration of callback.
example want enter number 55. when enter first 5, text variable empty. when enter second 5, text variable has value 5.
where mistaking?
i cant test - suspect because of callback using.
the keypressfcn
activated when press key - means running before key pressing has registered in control.
the fact see value you expect in debug sort of optical illusion - in fact not comparing real situation debug...
Comments
Post a Comment