What is consuming physical memory?

1 Ansicht (letzte 30 Tage)
Silvia
Silvia am 24 Jun. 2013
Hello,
I have a problem. I have a GUI with three axes and three sliders. At the begining the program is fast but if you move the sliders for a while it becomes slow (it is consuming physical memory). Here it's the code of one of the sliders. ¿Could you please help me to know which is the problem?:
global XsYs;
sliderC=handles.tam(2)-floor(get(handles.sliderCoronal,'Value'))+1;
XsYs(1,1)=sliderC;
XsYs(3,2)=sliderC;
axes(handles.imagencoronal)
imshow(squeeze(handles.VolumenImagen(:,sliderC,:)),[])
axis off
if get(handles.boxcoronal,'Value')
plot([1 handles.tam(3)],[XsYs(2,1) XsYs(2,1)],'Color','y');
plot([XsYs(2,2) XsYs(2,2)],[1 handles.tam(1)],'Color','m');
end
set(gca,'DataAspectRatio',[handles.dataresol(3) handles.dataresol(2) handles.dataresol(1)]);
set(findobj(handles.imagencoronal,'Type','Image'),'ButtonDownFcn','Segmentacion(''buttonDownCallback'',gcbo,[],guidata(gcbf))');
set(handles.textcorteC,'String','Corte','string',sliderC);
delete(findobj(handles.Segmentacion,'Color','g'))
if get(handles.boxaxial,'Value')
plot(handles.imagenaxial,[1 handles.tam(3)],[sliderC sliderC],'Color','g','LineStyle','-');
end
if get(handles.boxsagital,'Value')
plot(handles.imagensagital,[sliderC sliderC],[1 handles.tam(1)],'Color','g','LineStyle','-');
end
clear sliderC;
guidata(handles.Segmentacion,handles)
Thank you

Akzeptierte Antwort

Jan
Jan am 24 Jun. 2013
As far as I can see, you create new picture by imshow() and some plots each time the callback runs. This occupies memory.

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by