フィルターのクリア

closing the figure window when pressing the mouse button on the X

1 回表示 (過去 30 日間)
alex
alex 2012 年 10 月 21 日
I have a GUI that runs for a few minutes. in this GUI I have images that are shown continuesly using the lines-
axes('Position',[.3 .25 .3 .5]);
image(imcell{1,2});
the problem is that even if I use my mouse to close the window by pressing the X in the left upper edge , there is a new window opened up showing those images until the end.
so how can I break the GUI from working (closing it) without getting a new window.
I guess its something like the "windowbuttonpressfcn" or "buttonpressfcn", but-
I dont think that pressing on the x is considered as a press becuase its outside the window.. I tried using the get(hobject,'currentpoint') but it didn't work and I think that's not the way..
I should mention that just preventing the new window to pop won't help me because I have also audio files that will keep on playing.
I need something that will r3ealy stop the entire procces , not only whats seen on the screen.

採用された回答

Jan
Jan 2012 年 10 月 21 日
The CurrenPoint is not useful here.
Instead of creating new axes and images again and again, it would be more efficient to re-use the existing elements. And this would implicitly solve your problem also:
FigH = figure;
AxesH = axes('Position', [0.3, 0.25, 0.3, 0.5], 'Parent', FigH);
ImageH = [];
for ii = 1:1000
if ~ishandle(AxesH)
disp('Stopped by user');
return;
end
if isempty(ImageH)
ImageH = image(imcell{1,2}, 'Parent', AxesH);
else
set(ImageH, 'CData', imcell{1,2});
end
... Your code to create the new image here
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by