フィルターのクリア

The close(gcf) command awaiting the return key

3 ビュー (過去 30 日間)
Eric Condamine
Eric Condamine 2016 年 9 月 9 日
コメント済み: Walter Roberson 2016 年 9 月 13 日
In a script [exactly: the art.m from Artifact Detection Tools @ NITRC], there is a close(gcf) command which wait a press of the "return" key to actually close the desired window (if not, matlab stay in a busy state !)....
Due to this, it is not possible to use this script in a batch process ...
Any help will be very appreciate.
EDIT 1: By running the same script on a Mac OS X (Matlab 2015b) I have not observed this problem .... (I use Fedora 22 and Matlab 2013a). I don't see why the OS could be important in this case .... Is it a bug in Matlab 2013a ? ...
EDIT 2: I just installed the 2016a version on my station. I observe the same problem ...

回答 (1 件)

Eric Condamine
Eric Condamine 2016 年 9 月 13 日
編集済み: Eric Condamine 2016 年 9 月 13 日
The problem comes from the closerequestfcn property of the graphic object. The currently distributed art.m script contains this line:
set(handles.figure1,'closerequestfcn',['try,if isunix,txt=''rm ''; else txt=''del ''; end; [nill,ok]=system([txt,''',fullfile(output_dir,art_mask_temporalfile),''']);catch;end;close(gcbf);']);
This is a very elegant way to remove temporary files when the ART window is closed, but on my linux station, I have an alias for interactively remove the files or the directories (alias rm 'rm -i') ... So when the Art tool is running on an linux station with this configuration, the close(gcf) command awaits for an interactive action ... So, If you encounter this symptom, changing the previous line by the following should fix:
set(handles.figure1,'closerequestfcn',['try,if isunix,txt=''rm -f ''; else txt=''del ''; end; [nill,ok]=system([txt,''',fullfile(output_dir,art_mask_temporalfile),''']);catch;end;close(gcbf);']);
It could be a good idea that the next version of ART tool include this very minor change ...
  3 件のコメント
Eric Condamine
Eric Condamine 2016 年 9 月 13 日
This is very true, BUT, to be very robust, a code should run in all conditions, all configurations of a station (impossible in the real life !) and I think that the very little change I propose makes the script more robust.
Walter Roberson
Walter Roberson 2016 年 9 月 13 日
Well, you can always propose it to NITRC; the Answers forum doesn't have any connection to them.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by