📄 compute.m
字号:
handles.FST_err_txt, 'off', [], 'off', [], 'on' , [], 4 ;... 13
handles.showFDsp_checkbox, 'off', [], 'off', 0 , 'on' , 0 , 5 ;... 14
handles.Waveform_popup, 'off', [], 'off', 1 , 'off', 1 , 6 ;... 15
handles.Waveform_txt, 'off', [], 'off', [], 'off', [], 6 ;... 16
handles.Freq_edit, 'off', [], 'on' , [], 'off', [], 7 ;... 17
handles.Freq_txt, 'off', [], 'on' , [], 'off', [], 7 ;... 18
handles.NHT_radiobutton, 'off', [], 'on' , 0 , 'on' , 0 , 8 ;... 19
handles.NHT_tol_edit, 'off', [], 'off', [], 'off', [], 8 ;... 20
handles.NHT_tol_txt, 'off', [], 'off', [], 'off', [], 8 ;... 21
handles.FHT_radiobutton, 'off', [], 'on' , 1 , 'on' , 1 , 8 ;... 22
handles.FHT_err_edit, 'off', [], 'on' , [], 'on' , [], 8 ;... 23
handles.FHT_err_txt, 'off', [], 'on' , [], 'on' , [], 8 ;... 24
handles.FDspline_checkbox, 'off', [], 'off', 0 , 'on' , 1 , 9 ;... 25
handles.FDsp_NDEC_edit, 'off', [], 'off', [], 'on' , [], 9 ;... 26
handles.FDsp_NDEC_txt, 'off', [], 'off', [], 'on' , [], 9 ;... 27
handles.FDsp_Bmin_Bmax_txt, 'off', [], 'off', [], 'on' , [], 9 ;... 28
handles.FDsp_Bmin_edit, 'off', [], 'off', [], 'on' , [], 9 ;... 29
handles.FDsp_Bmax_edit, 'off', [], 'off', [], 'on' , [], 9 ;... 30
handles.Quad_tol_edit, 'off', [], 'off', [], 'off', [], 10;... 31
handles.Quad_tol_txt, 'off', [], 'off', [], 'off', [], 10;... 32
handles.Rspline_checkbox, 'off', [], 'off', 0 , 'off', 0 , 11;... 33
handles.Rsp_NDEC_txt, 'off', [], 'off', [], 'off', [], 11;... 34
handles.Rsp_NDEC_edit, 'off', [], 'off', [], 'off', [], 11;... 35
handles.Seg_tol_edit, 'off', [], 'off', [], 'off', [], 12;... 36
handles.Seg_tol_txt, 'off', [], 'off', [], 'off', [], 12;... 37
handles.Max_seg_edit, 'off', [], 'off', [], 'off', [], 12;... 38
handles.Max_seg_txt, 'off', [], 'off', [], 'off', [], 12};% 39
Settings(1).includeInComparison = find(~ismember( ...
[1:size(Settings(1).Defaults,1)], [9 10 12 13 20 21 23 24 36:39]));
Settings(2).Config = {'Dipole-Dipole'; ...
'*Capacitance*'; ...
'General Surface Array'; ...
'*GSA capacitance*'};
Settings(2).defaultDomain = 1; % = DC
Settings(2).Defaults = {... % DC FD TD group
handles.DC_radiobutton, 'on' , 1 , 'on' , 0 , 'off', [], 1 ;...
handles.Freqdom_radiobutton, 'on' , 0 , 'on' , 1 , 'off', [], 1 ;...
handles.Timedom_radiobutton, 'off', 0 , 'off', 0 , 'off', [], 1 ;...
handles.Full_sol_radiobutton,'off', 0 , 'on' , 0 , 'off', [], 2 ;...
handles.Quasi_radiobutton, 'off', 0 , 'on' , 1 , 'off', [], 2 ;...
handles.Times_edit, 'off', [], 'off', [], 'off', [], 3 ;...
handles.Times_txt, 'off', [], 'off', [], 'off', [], 3 ;...
handles.NST_radiobutton, 'off', 0 , 'off', 0 , 'off', [], 4 ;...
handles.NST_tol_edit, 'off', [], 'off', [], 'off', [], 4 ;...
handles.NST_tol_txt, 'off', [], 'off', [], 'off', [], 4 ;...
handles.FST_radiobutton 'off', 0 , 'off', 0 , 'off', [], 4 ;...
handles.FST_err_edit, 'off', [], 'off', [], 'off', [], 4 ;...
handles.FST_err_txt, 'off', [], 'off', [], 'off', [], 4 ;...
handles.showFDsp_checkbox, 'off', 0 , 'off', 0 , 'off', [], 5 ;...
handles.Waveform_popup, 'off', 1 , 'off', 1 , 'off', [], 6 ;...
handles.Waveform_txt, 'off', [], 'off', [], 'off', [], 6 ;...
handles.Freq_edit, 'off', [], 'on' , [], 'off', [], 7 ;...
handles.Freq_txt, 'off', [], 'on' , [], 'off', [], 7 ;...
handles.NHT_radiobutton, 'on' , 0 , 'on' , 0 , 'off', [], 8 ;...
handles.NHT_tol_edit, 'off', [], 'off', [], 'off', [], 8 ;...
handles.NHT_tol_txt, 'off', [], 'off', [], 'off', [], 8 ;...
handles.FHT_radiobutton, 'on' , 1 , 'on' , 1 , 'off', [], 8 ;...
handles.FHT_err_edit, 'on' , [], 'on' , [], 'off', [], 8 ;...
handles.FHT_err_txt, 'on' , [], 'on' , [], 'off', [], 8 ;...
handles.FDspline_checkbox, 'off', 0 , 'off', 0 , 'off', [], 9 ;...
handles.FDsp_NDEC_edit, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_NDEC_txt, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_Bmin_Bmax_txt, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_Bmin_edit, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_Bmax_edit, 'off', [], 'off', [], 'off', [], 9 ;...
handles.Quad_tol_edit, 'off', [], 'on' , [], 'off', [], 10;...
handles.Quad_tol_txt, 'off', [], 'on' , [], 'off', [], 10;...
handles.Rspline_checkbox, 'off', 0 , 'on' , 1 , 'off', [], 11;...
handles.Rsp_NDEC_txt, 'off', [], 'on' , [], 'off', [], 11;...
handles.Rsp_NDEC_edit, 'off', [], 'on' , [], 'off', [], 11;...
handles.Seg_tol_edit, 'off', [], 'off', [], 'off', [], 12;...
handles.Seg_tol_txt, 'off', [], 'off', [], 'off', [], 12;...
handles.Max_seg_edit, 'off', [], 'off', [], 'off', [], 12;...
handles.Max_seg_txt, 'off', [], 'off', [], 'off', [], 12};%
Settings(2).includeInComparison = find(~ismember( ...
[1:size(Settings(2).Defaults,1)], [9 10 12 13 20 21 23 24 36:39]));
Settings(3).Config = {'Wenner';
'Schlumberger'};
Settings(3).defaultDomain = 1; % = DC
Settings(3).Defaults = {... % DC FD TD group
handles.DC_radiobutton, 'on' , 1 , 'off', [], 'off', [], 1 ;...
handles.Freqdom_radiobutton, 'off', 0 , 'off', [], 'off', [], 1 ;...
handles.Timedom_radiobutton, 'off', 0 , 'off', [], 'off', [], 1 ;...
handles.Full_sol_radiobutton,'off', 0 , 'off', [], 'off', [], 2 ;...
handles.Quasi_radiobutton, 'off', 0 , 'off', [], 'off', [], 2 ;...
handles.Times_edit, 'off', [], 'off', [], 'off', [], 3 ;...
handles.Times_txt, 'off', [], 'off', [], 'off', [], 3 ;...
handles.NST_radiobutton, 'off', 0 , 'off', [], 'off', [], 4 ;...
handles.NST_tol_edit, 'off', [], 'off', [], 'off', [], 4 ;...
handles.NST_tol_txt, 'off', [], 'off', [], 'off', [], 4 ;...
handles.FST_radiobutton 'off', 0 , 'off', [], 'off', [], 4 ;...
handles.FST_err_edit, 'off', [], 'off', [], 'off', [], 4 ;...
handles.FST_err_txt, 'off', [], 'off', [], 'off', [], 4 ;...
handles.showFDsp_checkbox, 'off', 0 , 'off', [], 'off', [], 5 ;...
handles.Waveform_popup, 'off', 1 , 'off', [], 'off', [], 6 ;...
handles.Waveform_txt, 'off', [], 'off', [], 'off', [], 6 ;...
handles.Freq_edit, 'off', [], 'off', [], 'off', [], 7 ;...
handles.Freq_txt, 'off', [], 'off', [], 'off', [], 7 ;...
handles.NHT_radiobutton, 'on' , 0 , 'off', [], 'off', [], 8 ;...
handles.NHT_tol_edit, 'off', [], 'off', [], 'off', [], 8 ;...
handles.NHT_tol_txt, 'off', [], 'off', [], 'off', [], 8 ;...
handles.FHT_radiobutton, 'on' , 1 , 'off', [], 'off', [], 8 ;...
handles.FHT_err_edit, 'on' , [], 'off', [], 'off', [], 8 ;...
handles.FHT_err_txt, 'on' , [], 'off', [], 'off', [], 8 ;...
handles.FDspline_checkbox, 'off', 0 , 'off', [], 'off', [], 9 ;...
handles.FDsp_NDEC_edit, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_NDEC_txt, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_Bmin_Bmax_txt, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_Bmin_edit, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_Bmax_edit, 'off', [], 'off', [], 'off', [], 9 ;...
handles.Quad_tol_edit, 'off', [], 'off', [], 'off', [], 10;...
handles.Quad_tol_txt, 'off', [], 'off', [], 'off', [], 10;...
handles.Rspline_checkbox, 'off', 0 , 'off', [], 'off', [], 11;...
handles.Rsp_NDEC_txt, 'off', [], 'off', [], 'off', [], 11;...
handles.Rsp_NDEC_edit, 'off', [], 'off', [], 'off', [], 11;...
handles.Seg_tol_edit, 'off', [], 'off', [], 'off', [], 12;...
handles.Seg_tol_txt, 'off', [], 'off', [], 'off', [], 12;...
handles.Max_seg_edit, 'off', [], 'off', [], 'off', [], 12;...
handles.Max_seg_txt, 'off', [], 'off', [], 'off', [], 12};%
Settings(3).includeInComparison = find(~ismember( ...
[1:size(Settings(3).Defaults,1)], [9 10 12 13 20 21 23 24 36:39]));
Settings(4).Config = {'HCP FDEM (HLEM)'};
Settings(4).defaultDomain = 2; % = Frequency Domain
Settings(4).Defaults = {... % DC FD TD group
handles.DC_radiobutton, 'off', [], 'off', 0 , 'off', [], 1 ;...
handles.Freqdom_radiobutton, 'off', [], 'on' , 1 , 'off', [], 1 ;...
handles.Timedom_radiobutton, 'off', [], 'off', 0 , 'off', [], 1 ;...
handles.Full_sol_radiobutton,'off', [], 'on' , 0 , 'off', [], 2 ;...
handles.Quasi_radiobutton, 'off', [], 'on' , 1 , 'off', [], 2 ;...
handles.Times_edit, 'off', [], 'off', [], 'off', [], 3 ;...
handles.Times_txt, 'off', [], 'off', [], 'off', [], 3 ;...
handles.NST_radiobutton, 'off', [], 'off', 0 , 'off', [], 4 ;...
handles.NST_tol_edit, 'off', [], 'off', [], 'off', [], 4 ;...
handles.NST_tol_txt, 'off', [], 'off', [], 'off', [], 4 ;...
handles.FST_radiobutton 'off', [], 'off', 0 , 'off', [], 4 ;...
handles.FST_err_edit, 'off', [], 'off', [], 'off', [], 4 ;...
handles.FST_err_txt, 'off', [], 'off', [], 'off', [], 4 ;...
handles.showFDsp_checkbox, 'off', [], 'off', 0 , 'off', [], 5 ;...
handles.Waveform_popup, 'off', [], 'off', 1 , 'off', [], 6 ;...
handles.Waveform_txt, 'off', [], 'off', [], 'off', [], 6 ;...
handles.Freq_edit, 'off', [], 'on' , [], 'off', [], 7 ;...
handles.Freq_txt, 'off', [], 'on' , [], 'off', [], 7 ;...
handles.NHT_radiobutton, 'off', [], 'on' , 0 , 'off', [], 8 ;...
handles.NHT_tol_edit, 'off', [], 'off', [], 'off', [], 8 ;...
handles.NHT_tol_txt, 'off', [], 'off', [], 'off', [], 8 ;...
handles.FHT_radiobutton, 'off', [], 'on' , 1 , 'off', [], 8 ;...
handles.FHT_err_edit, 'off', [], 'on' , [], 'off', [], 8 ;...
handles.FHT_err_txt, 'off', [], 'on' , [], 'off', [], 8 ;...
handles.FDspline_checkbox, 'off', [], 'off', 0 , 'off', [], 9 ;...
handles.FDsp_NDEC_edit, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_NDEC_txt, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_Bmin_Bmax_txt, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_Bmin_edit, 'off', [], 'off', [], 'off', [], 9 ;...
handles.FDsp_Bmax_edit, 'off', [], 'off', [], 'off', [], 9 ;...
handles.Quad_tol_edit, 'off', [], 'off', [], 'off', [], 10;...
handles.Quad_tol_txt, 'off', [], 'off', [], 'off', [], 10;...
handles.Rspline_checkbox, 'off', [], 'off', 0 , 'off', [], 11;...
handles.Rsp_NDEC_txt, 'off', [], 'off', [], 'off', [], 11;...
handles.Rsp_NDEC_edit, 'off', [], 'off', [], 'off', [], 11;...
handles.Seg_tol_edit, 'off', [], 'off', [], 'off', [], 12;...
handles.Seg_tol_txt, 'off', [], 'off', [], 'off', [], 12;...
handles.Max_seg_edit, 'off', [], 'off', [], 'off', [], 12;...
handles.Max_seg_txt, 'off', [], 'off', [], 'off', [], 12};%
Settings(4).includeInComparison = find(~ismember( ...
[1:size(Settings(4).Defaults,1)], [9 10 12 13 20 21 23 24 36:39]));
handles.Settings = Settings;
% Define context menu of the Calculate-button
cmenu = uicontextmenu('parent', handles.figure1);
set(handles.Calculate_button, 'UIContextMenu', cmenu);
cb = ['compute(''calculate_batch'',gcbo,[],guidata(gcbo));'];
handles.calc_batch_menu = uimenu(cmenu, 'Label', ['Batch calculation'] , 'Callback', cb, 'visible','off');
% Define context menu of the batch-button
cmenu = uicontextmenu('parent', handles.figure1);
set(handles.Batch_button, 'UIContextMenu', cmenu);
cb = ['compute(''load_batch'',gcbo,[],guidata(gcbo));'];
handles.load_batch_menu = uimenu(cmenu, 'Label', ['Load batch list'] , 'Callback', cb, 'visible','on');
cb = ['compute(''save_batch'',gcbo,[],guidata(gcbo));'];
handles.save_batch_menu = uimenu(cmenu, 'Label', ['Save batch list'] , 'Callback', cb, 'visible','off');
cb = ['compute(''clear_batch'',gcbo,[],guidata(gcbo));'];
handles.clear_batch_menu = uimenu(cmenu, 'Label', ['Clear batch list'] , 'Callback', cb, 'visible','off');
modelwin_han = guidata(handles.modelwin);
menu1 = [handles.calc_batch_menu; handles.save_batch_menu; handles.clear_batch_menu];
if isfield(modelwin_han, 'batch') && ~isempty(modelwin_han.batch)
set(menu1, 'visible', 'on');
else
set(menu1, 'visible', 'off');
end
guidata(hObject, handles);
% -------------------------------------------------------------------------
function setup_gui(hObject, eventdata, handles, domain)
modelwin_han = guidata(handles.modelwin);
k = 1;
while ~any(ismember(handles.Settings(k).Config, ...
modelwin_han.config.type)) && ...
~(k>length(handles.Settings))
k = k+1;
end % while, k now should hold index into settings for the current config
if k>length(handles.Settings)
error('test','Invalid configuration!')
end % if
PropName = {'Enable', 'Value'};
id = [];
switch upper(domain)
case {'DEFAULT'}
% Choose either default domain, or current domain if one is
% chosen and if it is allowed for the new config.
if strcmpi(get(handles.figure1, 'visible'), 'on')
currentDomain = cell(3,2);
currentDomain = get(cell2mat( ...
handles.Settings(k).Defaults(1:3,1)), PropName);
m = 1;
while currentDomain{m,2}~=1
m = m+1;
end
if strcmpi(handles.Settings(k).Defaults(m, ...
handles.Settings(k).defaultDomain*2), ...
currentDomain(m,1))
id = [m*2,m*2+1];
end % if
else
% If this is first run, make sure all UIcontrols are turned
% off to ensure correct setting of default values below
set([handles.Settings(1).Defaults{:,1}], 'enable', 'off');
end % if
if isempty(id)
id = [handles.Settings(k).defaultDomain.*2 ...
handles.Settings(k).defaultDomain.*2+1];
end % if
case {'DC'}
id = [2:3];
case {'FD'}
id = [4:5];
case {'TD'}
id = [6:7];
otherwise
error('Compute:setup_gui:domainerr','Invalid calculation domain!');
end % switch
% The following code makes sure we only change the values of the
% UIcontrols that must actually change 'enable' property. Thus even
% though the default value of NHT_radiobutton is 0, if you have
% previously set it to 1, and the 'enable' property does not change,
% it should still be 1.
CurrentState = cell(size(handles.Settings(k).Defaults,1),2);
CurrentState = get(cell2mat(handles.Settings(k).Defaults(:,1)), PropName);
GroupNos = cell2mat(handles.Settings(k).Defaults( ...
handles.Settings(k).includeInComparison,8));
% find UIcontrols with a change in the 'Enable' state
mustChangeStateGroupNo = unique(GroupNos( ...
~strcmpi(handles.Settings(k).Defaults( ...
handles.Settings(k).includeInComparison,id(1)), ...
CurrentState(handles.Settings(k).includeInComparison,1))));
if ~isempty(mustChangeStateGroupNo)
% find index into handles.Settings.Defaults
GroupNos = cell2mat(handles.Settings(k).Defaults(:,8));
mustChangeStateId = find(ismember(GroupNos, mustChangeStateGroupNo));
% Set UICONTROLS settings
set(cell2mat(handles.Settings(k).Defaults(mustChangeStateId,1)), ...
PropName(1:2), handles.Settings(k).Defaults(mustChangeStateId,id));
end
storeAllSettings(hObject, [], handles);
% -------------------------------------------------------------------------
function storeAllSettings(hObject, eventdata, handles)
% This function stores all relevant (selected) values and settings of the
% gui in the cparams structure, ready to pass on to one of the modelling
% routines.
if get(handles.DC_radiobutton, 'value') == 1
cparams.domain = 'DC';
elseif get(handles.Freqdom_radiobutton, 'value') == 1
cparams.domain = 'FD';
else
cparams.domain = 'TD';
end % if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -