What is consuming physical memory?

조회 수: 1 (최근 30일)
Silvia
Silvia 2013년 6월 24일
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

채택된 답변

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by