📄 cr1dmod.m
字号:
tmpstr = ['[' sprintf('%i ',handles.config.Aspac)];
tmpstr(end) = ']';
set(handles.Aspac_edit,'String',tmpstr,'visible','on');
else
set(handles.Aspac_edit, 'String', ...
num2str(handles.config.Aspac),'visible','on');
end
% transmitter electrode C1 P1 P2 C2
% transmitter electrode o------o------o------o
% receiver electrode a a a
handles.config.C1 = [-1.5.*handles.config.Aspac(1) 0 0];
handles.config.C2 = [1.5.*handles.config.Aspac(1) 0 0];
handles.config.P1 = [-0.5.*handles.config.Aspac(1) 0 0];
handles.config.P2 = [0.5.*handles.config.Aspac(1) 0 0];
handles.config.Cwire = [];
handles.config.Pwire = [];
case {'Schlumberger'}
set(handles.topview_button,'enable','on');
set([handles.Aspac_edit handles.Aspactxt],'visible','off');
set([handles.Nspac_edit handles.Nspactxt],'visible','off');
set([handles.Tx_side_edit handles.Tx_side_txt],'visible','off');
set([handles.Rx_area_edit handles.Rx_area_txt],'visible','off');
set([handles.OA_edit handles.OA_txt],'visible','on');
set([handles.OM_edit handles.OM_txt],'visible','on');
set([handles.Rspac_edit handles.Rspac_txt], 'visible', 'off');
if length(handles.config.OA)>1
tmpstr = ['[' sprintf('%i ',handles.config.OA)];
tmpstr(end) = ']';
set(handles.OA_edit,'String',tmpstr,'visible','on');
else
set(handles.OA_edit,'String',num2str(handles.config.OA), ...
'visible','on');
end
if length(handles.config.OM)>1
tmpstr = ['[' sprintf('%i ',handles.config.OM)];
tmpstr(end) = ']';
set(handles.OM_edit,'String',tmpstr,'visible','on');
else
set(handles.OM_edit,'String',num2str(handles.config.OM), ...
'visible','on');
end
% transmitter electrode C1 P1 P2 C2
% transmitter electrode o--------o---o--------o
% receiver electrode | OA |
% receiver electrode | | OM
handles.config.C1 = [-handles.config.OA(1) 0 0];
handles.config.C2 = [handles.config.OA(1) 0 0];
handles.config.P1 = [-handles.config.OM(1) 0 0];
handles.config.P2 = [handles.config.OM(1) 0 0];
handles.config.Cwire = [];
handles.config.Pwire = [];
case {'TEM Central Loop'}
set(handles.topview_button,'enable','off');
set([handles.Aspac_edit handles.Aspactxt],'visible','off');
set([handles.Nspac_edit handles.Nspactxt],'visible','off');
set([handles.OA_edit handles.OA_txt],'visible','off');
set([handles.OM_edit handles.OM_txt],'visible','off');
set([handles.Tx_side_edit handles.Tx_side_txt],'visible','on');
set([handles.Rx_area_edit handles.Rx_area_txt],'visible','on');
set([handles.Rspac_edit handles.Rspac_txt], 'visible', 'off');
t = [0:pi/100:pi]';
if isfield(handles.config,'plot_handle') & ...
ishandle(handles.config.plot_handle)
delete(handles.config.plot_handle);
handles.config.plot_handle=[];
end
yscale = diff(get(handles.axes1,'ylim'));
handles.config.plot_handle(1) = line(cos(t)*100, ...
sin(t).*4.*yscale./70,'linewidth',2,'color','b');
handles.config.plot_handle(2) = line(cos(t)*25, ...
sin(t).*1.*yscale./70,'linewidth',2,'color','b');
set(handles.axes1,'xlim',[-120 120]);
case {'HCP FDEM (HLEM)'}
set(handles.topview_button,'enable','off');
set([handles.Aspac_edit handles.Aspactxt],'visible','off');
set([handles.Nspac_edit handles.Nspactxt],'visible','off');
set([handles.OA_edit handles.OA_txt],'visible','off');
set([handles.OM_edit handles.OM_txt],'visible','off');
set([handles.Tx_side_edit handles.Tx_side_txt],'visible','off');
set([handles.Rx_area_edit handles.Rx_area_txt],'visible','off');
set([handles.Rspac_edit handles.Rspac_txt],'visible','on');
if isfield(handles.config,'plot_handle') & ...
ishandle(handles.config.plot_handle)
delete(handles.config.plot_handle);
handles.config.plot_handle=[];
end
yscale = diff(get(handles.axes1,'ylim'));
t = [0:pi/100:2.*pi]';
handles.config.plot_handle(1) = line(cos(t)*10-50, ...
sin(t).*yscale./70,'linewidth',2,'color','b');
handles.config.plot_handle(2) = line(cos(t)*10+50, ...
sin(t).*yscale./70,'linewidth',2,'color','b');
handles.config.plot_handle(3) = line(-[50 50], ...
[-yscale +yscale].*1.5./70,'linewidth',2,'color','b');
handles.config.plot_handle(4) = line(+[50 50], ...
[-yscale +yscale].*1.5./70,'linewidth',2,'color','b');
set(handles.axes1,'xlim',[-120 120]);
end
switch handles.config.type
case {'Dipole-Dipole', ...
'*Capacitance*', ...
'General Surface Array', ...
'*GSA capacitance*', ...
'Wenner', ...
'Schlumberger'}
if isfield(handles.config,'plot_handle') & ...
ishandle(handles.config.plot_handle)
delete(handles.config.plot_handle);
handles.config.plot_handle=[];
end
handles.config.plot_handle(1) = line(handles.config.C1(1),0, ...
'marker','v');
handles.config.plot_handle(2) = line(handles.config.C2(1),0, ...
'marker','v');
handles.config.plot_handle(3) = line(handles.config.P1(1),0, ...
'marker','v');
handles.config.plot_handle(4) = line(handles.config.P2(1),0, ...
'marker','v');
xcoords = [min([handles.config.C1 handles.config.C2 ...
handles.config.P1 handles.config.P2]) ...
max([handles.config.C1 handles.config.C2 ...
handles.config.P1 handles.config.P2])];
set(handles.axes1,'xlim',([xcoords(1)-diff(xcoords)*0.15 ...
xcoords(2)+diff(xcoords)*0.15]));
end
handles = update_model(handles);
% --------------------------------------------------------------------% --- Executes on selection change in Config_popup.function Config_popup_Callback(hObject, eventdata, handles)
list = get(handles.Config_popup,'string');
handles.config.type = list{get(handles.Config_popup,'Value')};
handles = update_config(handles);
guidata(hObject,handles);
if isfield(handles, 'compute_win') & ishandle(handles.compute_win)
compute('setup_gui',handles.compute_win, [], ...
guidata(handles.compute_win), 'Default');
end
% --------------------------------------------------------------------function Aspac_edit_Callback(hObject, eventdata, handles)
[num,isOK] = str2num(get(handles.Aspac_edit,'String'));
if isOK && all(isfinite(num))
handles.config.Aspac = num;
else
set(handles.Aspac_edit,'String',num2str(handles.config.Aspac));
end
handles.config.Aspac = str2num(get(handles.Aspac_edit,'String'));
handles = update_config(handles);
handles = update_model(handles);
guidata(hObject, handles);
% --------------------------------------------------------------------function Nspac_edit_Callback(hObject, eventdata, handles)
[num,isOK] = str2num(get(handles.Nspac_edit,'String'));
if isOK && all(isfinite(num))
handles.config.Nspac = num;
else
set(handles.Nspac_edit,'String',num2str(handles.config.Nspac ));
end
handles = update_config(handles);
handles = update_model(handles);
guidata(hObject, handles);
% --------------------------------------------------------------------
function OA_edit_Callback(hObject, eventdata, handles)
[num,isOK] = str2num(get(handles.OA_edit,'String'));
if isOK && all(isfinite(num))
handles.config.OA = num;
else
set(handles.OA_edit,'String',num2str(handles.config.OA ));
end
handles = update_config(handles);
handles = update_model(handles);
guidata(hObject, handles);
% --------------------------------------------------------------------
function OM_edit_Callback(hObject, eventdata, handles)
[num,isOK] = str2num(get(handles.OM_edit,'String'));
if isOK && all(isfinite(num))
handles.config.OM = num;
else
set(handles.OM_edit,'String',num2str(handles.config.OM ));
end
handles = update_config(handles);
handles = update_model(handles);
guidata(hObject, handles);
% --------------------------------------------------------------------
function Rspac_edit_Callback(hObject, eventdata, handles)
[num,isOK] = str2num(get(handles.Rspac_edit,'String'));
if isOK && all(isfinite(num))
handles.config.Rspac = num;
else
set(handles.Rspac_edit,'String',num2str(handles.config.Rspac));
end
handles = update_config(handles);
handles = update_model(handles);
guidata(hObject, handles);
% --------------------------------------------------------------------function File_Callback(hObject, eventdata, handles)% hObject handle to File (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function Open_Callback(hObject, eventdata, handles)% hObject handle to Open (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = uigetfile( ...
{'*.mat', 'Model file (*.mat)';...
'*.*', 'All Files (*.*)'}, ...
'Load model:');
if ~isequal(filename,0) & ~isequal(pathname,0)
input = load([pathname filesep filename]);
if ~isstruct(input) || (~isfield(input, 'model') && ~isfield(input, 'batchlist'))
disp('cr1dmod.m:Open_Callback:NoModelInFile No model data found in file!');
error('cr1dmod.m:Open_Callback:NoModelInFile', ...
'No model data found in file!');
end
if isfield(input, 'batchlist')
input.model = rmfield(input.batchlist(1), 'cparams');
% Here we should allow for user choice of which model to use, and
% to include also the calculation parameters.
end
if isfield(input, 'model') && isstruct(input.model) && ...
isfield(input.model, 'layers') && isfield(input.model, 'config')
delete([[handles.layers.label_handle] ...
[handles.config.plot_handle]]);
handles.config = [];
handlesToRemove = [];
if length(handles.layers) > 1
handlesToRemove = [[handles.layers.interface_handle] ...
[handles.layers.prop_lab_handle]];
else
handlesToRemove = [handles.layers.prop_lab_handle];
end
delete(handlesToRemove);
handles.layers = [];
handles.config = input.model.config;
handles.layers = input.model.layers;
handles = update_config(handles);
% handles = update_model(handles);
update_layer_param(handles);
if length(handles.layers) > 1
set(handles.axes1, 'ylim', ([-1 2/5] * (9/7 * ...
handles.layers(end).depth_to_top)));
end
handles = update_model(handles);
guidata(hObject,handles);
end
end
% --------------------------------------------------------------------function Save_Callback(hObject, eventdata, handles)% hObject handle to Save (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = uiputfile( ...
{'*.mat', 'CR1Dmod model file (*.mat)'; ...
'*.*', 'All Files (*.*)'}, ...
'Save model as:');
[tmp, filename,ext] = fileparts(filename);
if isempty(ext), ext = '.mat'; end
model.config = rmfield(handles.config,{'plot_handle'});
model.layers = rmfield(handles.layers,{'label_handle'});
if isfield(model.layers,'interface_handle')
model.layers = rmfield(model.layers,{'interface_handle', ...
'prop_lab_handle'});
end
save(fullfile(pathname, [filename ext]), 'model');%,'-MAT');
% --------------------------------------------------------------------function Compute_Callback(hObject, eventdata, handles)% hObject handle to Compute (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------function Calculate_Callback(hObject, eventdata, handles)% hObject handle to Untitled_2calculate (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
compute_win = compute(handles.figure1);
handles = guidata(hObject);
handles.compute_win = compute_win;
guidata(hObject, handles);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -