Azzera filtri
Azzera filtri

Unknow error due to push second button when first button has already pushed

2 visualizzazioni (ultimi 30 giorni)
I have develop a programs which has several buttons. Les's say pushbutton1 and pushbutton2. When pushbutton1 is pushed, the program is running. However, when pushbutton2 is pressed, following error is appear. What is the problems?
Error using
tpac6de6f0_2275_443d_a558_3c8bef237e41>pushbutton2_Callback (line
1124)
Not enough input arguments.
Error using drawnow
Error while evaluating uicontrol Callback
if val1==1
y1=audioread(strcat(handles.path_wave,handles.name_wave),[round((counter-1)*len*Fs)+1 round((counter)*len*Fs)-1]);
handles.player1 = audioplayer(y1, Fs);
j=i+1;
% save all data to the handles object
handles.y = y1';
handles.Fs = Fs;
handles.timeSec = length(y1)/Fs;
handles.atSample = 0;
[row col]=size(y1);
while flag1==0
try
play(handles.player1);
tic
H3=scatter(handles.axes3,[1:counter],play_time(1:counter),10);
set(H3,'MarkerFaceColor','red');
set(H3,'MarkerEdgeColor','red');
set(H3,'LineWidth',1);
% assign a periodic timer to fire during playback
cla(handles.axes2);
h1=plot(handles.axes2,y1);
set(h1,'linewidth',0.001)
set(h1,'color',[0.5 0.5 0.5])
overal=overal+len;
counter=counter+1;
y2=audioread(strcat(handles.path_wave,handles.name_wave),[round((counter-1)*len*Fs)+1 round((counter)*len*Fs)-1]);
handles.player2 = audioplayer(y2, Fs);
flag_forward=0;
flag_backward=0;
real_time=toc;
while real_time<len && flag_forward==0 && flag_backward==0
if (time(j)-time(i))<real_time && time(j)<overal
H=scatter(handles.axes1,Normalized_Longitude(j),Normalized_Latitude(j),'b');
set(H,'MarkerFaceColor','blue');
set(H,'MarkerEdgeColor','blue');
handles.F(j) = getframe(gcf);
refreshdata
drawnow
i=j;
j=i+1;
end
temp_flag=0;
a=get(handles.pushbutton4, 'userdata') ;
b=get(handles.pushbutton2, 'userdata') ;
real_time=toc;
while ~a || ~b
a=get(handles.pushbutton4, 'userdata') ;
b=get(handles.pushbutton2, 'userdata') ;
pause(handles.player1);
drawnow;
temp_flag=1;
end
if temp_flag==1
tic
timer1=toc;
while (timer1-real_time)<0.00001
timer1=toc;
end
resume(handles.player1);
end
function pushbutton2_Callback(hObject, eventdata, handles)
*error is here=>* if get(handles.pushbutton2,'userdata')==1
set(handles.pushbutton2,'userdata',0);
else
set(handles.pushbutton2,'userdata',1);
end
  1 Commento
Geoff Hayes
Geoff Hayes il 4 Set 2017
amir - what is line 1124? Based on the error message, the problem seems to be with drawnow but that doesn't make much sense. Please post the full error message and the line of code that is generating the error.

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 4 Set 2017
The error could occur there if you had done the equivalent of
set(handles.pushbutton2, 'Callback', @pushbutton2_Callback)
somewhere in your code. For example you might have dynamically created the pushbutton uicontrol.
If you let GUIDE handle creation of the pushbutton2 then the problem should not occur.
At the MATLAB command line, give the command
dbstop if error
and run the code until the problem shows up. When it does, give the command
get( findall(0, 'tag', 'pushbutton2'), 'Callback' )
and show us the result.

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by