📄 siginputfig.asv
字号:
function varargout = siginputfig(varargin)
% SIGINPUT Application M-file for siginput.fig
% FIG = SIGINPUT launch siginput GUI.
% SIGINPUT('callback_name', ...) invoke the named callback.
% Last Modified by GUIDE v2.5 29-Apr-2003 14:16:45
global x y dz z
global sigbody
global phan
global sigb
if nargin == 0 % LAUNCH GUI
if exist('intem3d.par')
p={' ',' '};
p=buf2par(p,readtxt('intem3d.par'));
sig0=getpar(p,'double','sig0','','');
hh0=getpar(p,'double','hh0','','');
x=getpar(p,'double','x', '','');Nx=length(x);dx=x(2)-x(1);
y=getpar(p,'double','y', '','');Ny=length(y);dy=y(2)-y(1);
z=getpar(p,'double','z', '','');Nz=length(z);
dz=getpar(p,'double','dz', '','');
% if length(hh0)==0 sigb=ones(1,length(dz)); sigb=sigb*sig0; end
sigb=bgcond(hh0,sig0,x,y,z);
sigb=reshape(sigb,Nx,Ny,Nz);
else
x=-1000:100:1000;Nx=length(x);dx=x(2)-x(1);
y=-1000:100:1000;Ny=length(y);dy=y(2)-y(1);
z=300:100:1000;Nz=length(z);
dz=100*ones(1,Nz);
end;
if exist('sigbody.dat')
sigbody=loadasc('sigbody.dat');
if (size(sigbody)==[1 1]) sigbody=sigbody*ones(Nx,Ny,Nz);
else sigbody=reshape(sigbody,Nx,Ny,Nz);
sigbody=sigbody-sigb;
end;
else sigbody=zeros(Nx,Ny,Nz);
end;
fig = openfig(mfilename,'reuse');
% Use system color scheme for figure:
set(fig,'Color',get(0,'defaultUicontrolBackgroundColor'));
% Generate a structure of handles to pass to callbacks, and store it.
handles = guihandles(fig);
guidata(fig, handles);
if nargout > 0
varargout{1} = fig;
end
set(handles.X,'String',['X= ' num2str(x(1)) ':' num2str(dx) ':' num2str(x(Nx)) ' m']);
set(handles.Y,'String',['Y= ' num2str(y(1)) ':' num2str(dy) ':' num2str(y(Ny)) ' m']);
set(handles.Z,'String',['Z= ' num2str(z(1)) ':' num2str(z(Nz)) ' m']);
set(handles.depth_in_meters,'String',[num2str(z(str2double(get(handles.depth,'String')))) ' m']);
map=colormap;
depth=str2double(get(handles.depth,'String'));
maxs=max(sigbody(:));
mins=min(sigbody(:));
axes(handles.sigma);
for ik=1:Nx
for jk=1:Ny
phan(ik,jk)=patch([x(ik)+dx/2 x(ik)-dx/2 x(ik)-dx/2 x(ik)+dx/2],...
[y(jk)+dy/2 y(jk)+dy/2 y(jk)-dy/2 y(jk)-dy/2],'w');
if sigbody(ik,jk,depth)
if (maxs==mins) col=32;
else col=round(1+(sigbody(ik,jk,depth)-mins)*63/(maxs-mins));
end;
set(phan(ik,jk),'FaceColor',map(col,:));
end;
end;
end;
elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK
try
[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
catch
disp(lasterr);
end
end
%| ABOUT CALLBACKS:
%| GUIDE automatically appends subfunction prototypes to this file, and
%| sets objects' callback properties to call them through the FEVAL
%| switchyard above. This comment describes that mechanism.
%|
%| Each callback subfunction declaration has the following form:
%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)
%|
%| The subfunction name is composed using the object's Tag and the
%| callback type separated by '_', e.g. 'slider2_Callback',
%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.
%|
%| H is the callback object's handle (obtained using GCBO).
%|
%| EVENTDATA is empty, but reserved for future use.
%|
%| HANDLES is a structure containing handles of components in GUI using
%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This
%| structure is created at GUI startup using GUIHANDLES and stored in
%| the figure's application data using GUIDATA. A copy of the structure
%| is passed to each callback. You can store additional information in
%| this structure at GUI startup, and you can change the structure
%| during callbacks. Call guidata(h, handles) after changing your
%| copy to replace the stored original so that subsequent callbacks see
%| the updates. Type "help guihandles" and "help guidata" for more
%| information.
%|
%| VARARGIN contains any extra arguments you have passed to the
%| callback. Specify the extra arguments by editing the callback
%| property in the inspector. By default, GUIDE sets the property to:
%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))
%| Add any extra arguments after the last argument, before the final
%| closing parenthesis.
% --------------------------------------------------------------------
function varargout = pushbutton1_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.pushbutton1.
%disp('pushbutton1 Callback not implemented yet.')
% --------------------------------------------------------------------
function varargout = depth_Callback(h, eventdata, handles, varargin)
global z
% Stub for Callback of the uicontrol handles.depth.
set(handles.depth_in_meters,'String',num2str(z(str2double(get(handles.depth,'String')))));
% --------------------------------------------------------------------
function varargout = depth_DeleteFcn(h, eventdata, handles, varargin)
% Stub for DeleteFcn of the uicontrol handles.depth.
%disp('depth DeleteFcn not implemented yet.')
% --------------------------------------------------------------------
function varargout = inputbut_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.inputbut.
%disp('inputbut Callback not implemented yet.')
global x y dz z
global sigbody
global phan
Nx=length(x);
Ny=length(y);
Nz=length(z);
dx=x(2)-x(1);dy=y(2)-y(1);
depth=str2double(get(handles.depth,'String'));
val =str2double(get(handles.value,'String'));
if (depth<=Nz) set(handles.depth_in_meters,'String',[num2str(z(depth)) ' m']);
else disp('Error: depth is greater then the length of Z');return;
end;
maxs=max([sigbody(find(sigbody)); val]);
mins=min([sigbody(find(sigbody)); val]);
map=colormap;
axes(handles.cbar);
%ylim([mins maxs]);
if (maxs==mins) image([],linspace(0.5*maxs,1.5*mins,64),(linspace(64,1,64))')
else image([],linspace(maxs,mins,64),(linspace(64,1,64))')
end;
set(handles.cbar,'YDir','normal');
set(handles.cbar,'XTickLabel',[]);
title('S/m');
axes(handles.sigma);
for ik=1:Nx
for jk=1:Ny
if sigbody(ik,jk,depth)
if (maxs==mins) col=32;
else col=round(1+(sigbody(ik,jk,depth)-mins)*63/(maxs-mins));
end;
set(phan(ik,jk),'FaceColor',map(col,:));
else
set(phan(ik,jk),'FaceColor','w');
end;
end;
end;
[xk yk]=ginput(1);
while and((xk>=x(1)-dx/2 & xk<=x(end)+dx/2),(yk>=y(1)-dy/2 & yk<=y(end)+dy/2)),
ind=find(x-dx/2<xk);
ik=ind(end);
ind=find(y-dy/2<yk);
jk=ind(end);
if (maxs==mins) col=32;
else col=round(1+(val-mins)*63/(maxs-mins));
end;
set(phan(ik,jk),'FaceColor',map(col,:));
sigbody(ik,jk,depth)=val;
[xk yk]=ginput(1);
end;
% --------------------------------------------------------------------
function varargout = value_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.value.
disp('value Callback not implemented yet.')
% --------------------------------------------------------------------
function varargout = pushbutton3_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.pushbutton3.
global x y dz z
global sigbody
global sigb
figure
maxs=max(sigbody(find(sigbody)));
mins=min(sigbody(find(sigbody)));
csize=[x(2)-x(1) y(2)-y(1) z(2)-z(1)];
Nx=length(x);
Ny=length(y);
Nz=length(z);
map=colormap;
axis([min(x)-x(2)+x(1) max(x)+x(2)-x(1) min(y)-y(2)+y(1) max(y)+y(2)-y(1) min(z)-dz(1) max(z)+dz(end)]);
for i=1:Nx
for j=1:Ny
for k=1:Nz
if sigbody(i,j,k)
if (maxs==mins)
col=32;
else
col=round((sigbody(i,j,k)-mins)/(maxs-mins)*62+1);
end;
corob(x(i),y(j),z(k),[x(2)-x(1) y(2)-y(1) dz(k)],map(col,1));
end;
end;
end;
end;
%alpha(0.5);
%xlim([min(x)-x(2)+x(1) max(x)+x(2)-x(1)]);ylim([min(y)-y(2)+y(1) max(y)+y(2)-y(1)]);zlim([min(z)-dz(1) max(z)+dz(end)]);
axis([min(x)-x(2)+x(1) max(x)+x(2)-x(1) min(y)-y(2)+y(1) max(y)+y(2)-y(1) min(z)-dz(1) max(z)+dz(end)]);
set(gca,'ZDir','reverse')
set(gca,'cameraposition',[max(x) max(y) min(z)]);
view(-46,10);
%light('position',[0 500 max(z)],'style','local');
%light('position',[1 0 0]);
grid on;
xlabel('x');ylabel('y');zlabel('z');
h=colorbar;
%wwwwwwwwwwwwwwwwwwwwwwww
if(isempty(maxs)|isempty(mins))
disp('anomalous area conductivity value is zero')
return
end
%wwwwwwwwwwwwwwwwwwwwwwwww
%if (maxs==mins) set(h,'yticklabel',linspace(0.5*mins,1.5*maxs,11));
if (maxs==mins) set(h,'yticklabel',linspace(0.5*mins,1.5*maxs,5));
else set(h,'yticklabel',0.01*round(100*linspace(mins,maxs,11)));
end;
axes(h);
title('S/m');
gca;
rotate3d on;
% --------------------------------------------------------------------
function varargout = pushbutton4_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.pushbutton4.
global sigbody
sigbody=0*sigbody;
% --------------------------------------------------------------------
function varargout = X_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.X.
disp('X Callback not implemented yet.')
% --------------------------------------------------------------------
function varargout = Y_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.Y.
disp('Y Callback not implemented yet.')
% --------------------------------------------------------------------
function varargout = Z_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.Z.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -