In the place you initialize indfin, set
and at the end of that routine,
guidata(hObject, handles);
Then in the callback that you currently have the "for" loop, change to
i = handles.curseg;
if i <= length(indfin)
next=output_signal(indini(i):indfin(i));
subplot(211)
t=[0:(length(next)-1)]*(1/fs);
plot(t,next)
xlabel('tiempo(seg)')
subplot(212)
[ysa,f,t,p] = spectrogram(next,2*1024,2*1000,512,fs);
surf(t,f,10*log10(abs(p)),'EdgeColor','none');
axis xy; axis tight; colormap(jet); view(0,90);
xlabel('Tiempo');
ylabel('Frecuencia (Hz)');
drawnow();
soundsc(next,fs);
handles.curseg = i + 1;
end
and at the end of that routine,
guidata(hObject, handles);
This code does nothing when the end is reached; you will probably want to change that.
Best Answer