0001 function project_mgr_close(fig)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 if ~exist('fig', 'var') || isempty(fig) || ~ishandle(fig)
0017 error('invalid figure handle is specified.');
0018 end
0019
0020
0021
0022
0023
0024
0025 data = guidata(fig);
0026
0027
0028 figures = inner_get_valid_handle(data.pa_brain_fig);
0029 if ~isempty(figures)
0030 for k=1:length(figures)
0031 pa_brain_close(figures(k));
0032 end
0033 end
0034
0035
0036 figures = inner_get_valid_handle(data.pa_fmri_fig);
0037 if ~isempty(figures)
0038 for k=1:length(figures)
0039 pa_fmri_close(figures(k));
0040 end
0041 end
0042
0043
0044 figures = inner_get_valid_handle(data.pa_biosemi_eeg_fig);
0045 if ~isempty(figures)
0046 for k=1:length(figures)
0047 pa_biosemi_eeg_close(figures(k));
0048 end
0049 end
0050
0051
0052 figures = inner_get_valid_handle(data.pa_brainamp_eeg_fig);
0053 if ~isempty(figures)
0054 for k=1:length(figures)
0055 pa_brainamp_eeg_close(figures(k));
0056 end
0057 end
0058
0059
0060 figures = inner_get_valid_handle(data.pa_yokogawa_meg_fig);
0061 if ~isempty(figures)
0062 for k=1:length(figures)
0063 pa_yokogawa_meg_close(figures(k));
0064 end
0065 end
0066
0067
0068 figures = inner_get_valid_handle(data.pa_sbi_meg_fig);
0069 if ~isempty(figures)
0070 for k=1:length(figures)
0071 pa_sbi_meg_close(figures(k));
0072 end
0073 end
0074
0075
0076 figures = inner_get_valid_handle(data.pa_leadfield_fig);
0077 if ~isempty(figures)
0078 for k=1:length(figures)
0079 pa_leadfield_close(figures(k));
0080 end
0081 end
0082
0083
0084 figures = inner_get_valid_handle(data.bayes_fig);
0085 if ~isempty(figures)
0086 for k=1:length(figures)
0087 bayes_parm_editor(figures(k), 'finish_request');
0088 end
0089 end
0090
0091
0092 figures = inner_get_valid_handle(data.pa_head_fig);
0093 if ~isempty(figures)
0094 for k=1:length(figures)
0095 pa_head_close(figures(k));
0096 end
0097 end
0098
0099
0100 figures = inner_get_valid_handle(data.current_fig);
0101 if ~isempty(figures)
0102 for k=1:length(figures)
0103 current_gui_delete(figures(k));
0104 end
0105 end
0106
0107
0108 figures = inner_get_valid_handle(data.tools_fig);
0109 if ~isempty(figures)
0110 for k=1:length(figures)
0111 set(0, 'CurrentFigure', figures(k));
0112 tool_launcher('exit');
0113 end
0114 end
0115
0116
0117 figures = inner_get_valid_handle(data.batch_fig);
0118 if ~isempty(figures)
0119 for k=1:length(figures)
0120 delete(figures(k));
0121 end
0122 end
0123
0124
0125 delete(fig);
0126
0127 function [handles] = inner_get_valid_handle(handles)
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137 empty_ix = isempty(handles);
0138 if isempty(empty_ix)
0139 handles(empty_ix) = [];
0140 end
0141
0142
0143 valid_ix = find(ishandle(handles) == 1);
0144 handles = handles(valid_ix, :);