📄 lascreator.m
字号:
'Units','normalized',...
'BackgroundColor',[0.8 0.8 0.8],...
'Position',[0.0160 0.2245 0.0690 0.0333],...
'String','Layer: 4',...
'Style','text',...
'Tag','text60','uicontextmenu',cmenu);
hLayerName = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 1 1],...
'Position',[0.0900 0.2245 0.0850 0.0350],...
'String','',...
'Style','edit',...
'Tag','edit26','uicontextmenu',cmenu);
hQuickInfo = uicontrol(...
'Units','normalized',...
'BackgroundColor',[0.8 0.8 0.8],...
'Position',[0.0147 0.0947 0.1639 0.1245],...
'String',{ 'Meters' 'Vp: Vs:' 'Density:' },...
'Style','text',...
'Tag','text55','uicontextmenu',cmenu);
hheader1 = uicontrol(...
'Units','normalized',...
'BackgroundColor',[0.8 0.8 0.8],...
'Position',[0.1849 0.2175 0.0924 0.0315],...
'String','Depth',...
'Style','text',...
'Tag','text56','uicontextmenu',cmenu);
hdata1 = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 1 1],...
'Position',[0.1849 0.1807 0.0924 0.0315],...
'String','',...
'Style','edit',...
'Tag','edit27','uicontextmenu',cmenu);
hheader2 = uicontrol(...
'Units','normalized',...
'BackgroundColor',[0.8 0.8 0.8],...
'Position',[0.1849 0.1438 0.0924 0.0315],...
'String','Vp',...
'Style','text',...
'Tag','text57','uicontextmenu',cmenu);
hdata2 = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 1 1],...
'Position',[0.1849 0.1070 0.0924 0.0315],...
'String','',...
'Style','edit',...
'Tag','edit28','uicontextmenu',cmenu);
hheader3 = uicontrol(...
'Units','normalized',...
'BackgroundColor',[0.8 0.8 0.8],...
'Position',[0.2799 0.2175 0.0924 0.0315],...
'String','Vs',...
'Style','text',...
'Tag','text58','uicontextmenu',cmenu);
hdata3 = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 1 1],...
'Position',[0.2799 0.1807 0.0924 0.0315],...
'String','',...
'Style','edit',...
'Tag','edit29','uicontextmenu',cmenu);
hheader4 = uicontrol(...
'Units','normalized',...
'BackgroundColor',[0.8 0.8 0.8],...
'Position',[0.2799 0.1438 0.0924 0.0315],...
'String','Density',...
'Style','text',...
'Tag','text59','uicontextmenu',cmenu);
hdata4 = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 1 1],...
'Position',[0.2799 0.1070 0.0924 0.0315],...
'String','',...
'Style','edit',...
'Tag','edit30','uicontextmenu',cmenu);
BlockHandle4.Number=hLayerNumber;
BlockHandle4.Name=hLayerName;
BlockHandle4.Info=hQuickInfo;
BlockHandle4.Header1=hheader1;
BlockHandle4.Data1=hdata1;
BlockHandle4.Header2=hheader2;
BlockHandle4.Data2=hdata2;
BlockHandle4.Header3=hheader3;
BlockHandle4.Data3=hdata3;
BlockHandle4.Header4=hheader4;
BlockHandle4.Data4=hdata4;
BlockHandle4.Backing=hbacking;
BlockButtons.Block1=BlockButtons1;
BlockButtons.Block2=BlockButtons2;
BlockButtons.Block3=BlockButtons3;
BlockButtons.Block4=BlockButtons4;
BlockHandles.Block1=BlockHandle1;
BlockHandles.Block2=BlockHandle2;
BlockHandles.Block3=BlockHandle3;
BlockHandles.Block4=BlockHandle4;
% creating structure for data
% layer zero is a template for all subsuquent layers and for future layers
defaultlayersource={'LayerNumber' 'LayerName' 'Depth' 'DepthUnit' 'Vp' 'VpUnit',...
'Vs' 'VsUnit' 'Density' 'DensityUnit'};
defaultlayerdata={0 [] [] [] [] [] [] [] [] [] };
Layer0=[];
for ii=1:length(defaultlayersource)
% this is creating the default layer zero
Layer0=setfield(Layer0,defaultlayersource{ii},defaultlayerdata{ii});
end
LayerData=[];
for ii=1:5
% this is putting Layers into LayerData, with Layer0 at the start
newlayername=['Layer' num2str(ii-1)];
Layer0=setfield(Layer0,'LayerNumber',[ii-1]);
LayerData=setfield(LayerData,['Layer' num2str(ii-1)],Layer0);
end
AllInfo.Data=LayerData;
AllInfo.GeneralData=GeneralData;
AllInfo.BlockHandles=BlockHandles;
AllInfo.BlockButtons=BlockButtons;
AllInfo.FigureHandles=FigureHandles;
set(gcf,'userdata',AllInfo);
%--------------------------------
%----- UNIVERSAL DATA CHECK -----
%--------------------------------
%
% this routine checks data that is in the blocks to make sure user has not
% placed characters where numbers should be. It will also stop the cycling
% of the blocks if a depth has not been added to a block where it should
% have a depth. Only checks data that is visibly located in the figure
function controlout=lascreator_datacheck(hObject, eventdata, handles)
controlout={'Please ensure there is at least one depth at layer 1' -1};
%
% Pulling data out
h=get(gcf,'userdata');
LayerData=getfield(h,'Data');
GeneralData=getfield(h,'GeneralData');
BlockHandles=getfield(h,'BlockHandles');
BlockButtons=getfield(h,'BlockButtons');
FigureHandles=getfield(h,'FigureHandles');
hmsg=getfield(FigureHandles,'Message');
% -----------
nuldat=getfield(GeneralData,'NullValue');
nullval=get(nuldat,'string');
% checking nullval
checknul=str2num(nullval);
if(isempty(checknul))
% not a number buddy!
nullval='-999.25';
end
welldat=getfield(GeneralData,'Name');
wellname=get(welldat,'string');
% Checking name to see if testing.
if(findstr(wellname,'LASTEST:'))
lascreator_master_reset;
checkwellname=get(welldat,'string');
if(findstr(checkwellname,'LASTEST:'))
% has not been reset, must stop
return
end
rmov=findstr(wellname,':');
num=str2num(wellname(rmov+1:end));
if(isnumeric(num))
if(num<1)
num=2;
end
% Making a fake well log based on number input by user
testmat=[];
rot1={'Depth' 'Vp' 'Vs' 'Density'};
% reseting data
defaultlayersource={'LayerNumber' 'LayerName' 'Depth' 'DepthUnit' 'Vp' 'VpUnit',...
'Vs' 'VsUnit' 'Density' 'DensityUnit'};
defaultlayerdata={0 [] [] [] [] [] [] [] [] [] };
Layer0=[];
for ii=1:length(defaultlayersource)
% this is creating the default layer zero
Layer0=setfield(Layer0,defaultlayersource{ii},defaultlayerdata{ii});
end
LayerData=[];
for ii=1:5
% this is putting Layers into LayerData, with Layer0 at the start
newlayername=['Layer' num2str(ii-1)];
Layer0=setfield(Layer0,'LayerNumber',[ii-1]);
LayerData=setfield(LayerData,['Layer' num2str(ii-1)],Layer0);
end
for ii=1:abs(round(num))
testnums=100*ii;
try
lay=getfield(LayerData,['Layer' num2str(ii)]);
catch
% need to create a new layer
layerdataget=getfield(LayerData,'Layer0');
layerdataget=setfield(layerdataget,'LayerNumber',[ii]);
LayerData=setfield(LayerData,['Layer' num2str(ii)],layerdataget);
end
for jj=1:size(rot1,2)
LayerData=setfield(LayerData,['Layer' num2str(ii)],rot1{jj},testnums);
if(ii==1|ii==2|ii==3|ii==4)
% Setting the block info
blocknumerx=getfield(BlockHandles,['Block' num2str(ii)]);
for kk=1:4
set(getfield(blocknumerx,['Data' num2str(kk)]),'string',num2str(testnums));
end
end
end
end
% Must now chance test name slightly to stop major problems
set(welldat,'string',['Testing: ' num2str(ii) ' Layers']);
else
end
end
hdepthunit=getfield(GeneralData,'DepthUnits');
dat=get(hdepthunit,'string');
val=get(hdepthunit,'value');
depthunit=dat(val,:);
zstep=getfield(GeneralData,'ZStep');
Block1=getfield(BlockHandles,'Block1');
LayerNumber=getfield(Block1,'Number');
nm=get(LayerNumber,'string');
% nm has -1 taken from it for looping purposes later on
nm=str2num(nm(findstr(' ',nm)+1:end))-1;
% the following may eventually be part of block data
hDepthUnit=getfield(GeneralData,'DepthUnits');
hDensityUnit=getfield(GeneralData,'DensityUnits');
depunit1=get(hDepthUnit,'string');
denunit1=get(hDensityUnit,'string');
alldep=[];
alldat=cell(1,4);
checkdep=[]; % as long as checkdep is empty, different colours
% will be attempted to be created for blocks
% No longer blank means that there is an empty
% depth, which means subsuqent layers are ignored
for ii=1:4
% eventually, the block slider will have to be referenced when
% lascreator has expanded to allow more options
% getting blocks
blocknumerx=getfield(BlockHandles,['Block' num2str(ii)]);
hLayerNumber=getfield(blocknumerx,'Number');
hLayerName=getfield(blocknumerx,'Name');
hQuickInfo=getfield(blocknumerx,'Info');
hheader1=getfield(blocknumerx,'Header1');
hdata1=getfield(blocknumerx,'Data1');
hheader2=getfield(blocknumerx,'Header2');
hdata2=getfield(blocknumerx,'Data2');
hheader3=getfield(blocknumerx,'Header3');
hdata3=getfield(blocknumerx,'Data3');
hheader4=getfield(blocknumerx,'Header4');
hdata4=getfield(blocknumerx,'Data4');
% making groups of data
hdatas=[hdata1 hdata2 hdata3 hdata4];
hheaders=[hheader1 hheader2 hheader3 hheader4];
% getting depth and density units
hdepunit=getfield(GeneralData,'DepthUnits');
dat=get(hdepunit,'string');
val=get(hdepunit,'value');
depunit=dat(val,:);
hdenunit=getfield(GeneralData,'DensityUnits');
dat=get(hdenunit,'string');
val=get(hdenunit,'value');
denunit=dat(val,:);
% getting names of data to export, this whole section should be rewiten
% to work regardless of how many inputs the user has added
setdat=getfield(GeneralData,'SendData');
holdat={'dep' 'Vp' 'Vs' 'den'};
dep=get(hdatas(1),'string');
Vp=get(hdatas(2),'string');
Vs=get(hdatas(3),'string');
den=get(hdatas(4),'string');
for jj=1:4
holdat{jj}=get(hdatas(jj),'string');
end
if(dep==str2num(nullval)|~isempty(checkdep))
col1=0.8;
col2=0.8;
col3=0.8;
checkdep='STOP';
else
try
% this section is creating colours for different depths
swdat1=sort([str2num(Vp) str2num(dep)]);
col1=swdat1(1)/swdat1(2);
col2=1;
swdat1=sort([str2num(Vp) str2num(Vs)]);
col3=swdat1(1)/swdat1(2);
checkcol=[col1 col3];
for kk=1:2
if(isinf(checkcol(kk))|isnan(checkcol(kk)))
col1=0.8;
col2=0.8;
col3=0.8;
break
end
end
catch
col1=0.8;
col2=0.8;
col3=0.8;
end
end
col=[col1 col2 col3];
for jj=1:4
dat=get(hdatas(jj),'string');
dat=str2num(dat);
if(isempty(dat))
% making sure that data boxes are empty
set(hdatas(jj),'string','');
dat=[];
end
% making sure data boxes are white
set(hdatas(jj),'backgroundcolor',[1 1 1]);
% making sure header boxes are right colour
set(hheaders(jj),'backgroundcolor',col);
layerdataset=['Layer' num2str(nm+ii)];
LayerData=setfield(LayerData,layerdataset,setdat{jj},dat);
alldat{jj}=dat;
end
x1=[num2str(alldat{1}) ' ' depthunit{1}];
x2=['Vp: ' num2str(alldat{2}) ' Vs: ' num2str(alldat{3})];
x3=['Density: ' num2str(alldat{4})];
set(hQuickInfo,'string',{x1;x2;x3},'backgroundcolor',col);
set(hLayerNumber,'backgroundcolor',col);
nam=deblank(get(hLayerName,'string'));
% checking for special characters
checkchar={'[' ']' '(' ')' '{' '}' '=' '.' ',' ';' '%' '!',...
'+' '-' '*' '/' '\' '^' '<' '>' '=' '~' '&' '|' '@',...
'#' '$' '`' ':' '"'};
for kk=1:length(checkchar)
if(~isempty(findstr(checkchar{kk},nam)))
stringinfo=['Can Not Use "' checkchar{kk} '" In Name'];
set(hmsg,'string',stringinfo,'backgroundcolor',[1 1 0]);
return
end
end
layerdataget=getfield(LayerData,['Layer' num2str(nm+ii)]);
if(~isempty(nam))
layerdataget=setfield(layerdataget,'LayerName',nam);
else
layerdataget=setfield(layerdataget,'LayerName',[]);
end
LayerData=setfield(LayerData,['Layer' num2str(nm+ii)],layerdataget);
% getting depths for checking consitancy
dep=getfield(LayerData,['Layer' num2str(nm+ii)],'Depth');
if(isempty(dep))
adep=str2num(nullval);
else
adep=dep;
end
alldep=[alldep;adep];
LayerData=setfield(LayerData,['Layer' num2str(nm+ii)],'DepthUnit',depunit{1});
LayerData=setfield(LayerData,['Layer' num2str(nm+ii)],'DensityUnit',denunit{1});
end
alldep2=alldep;
for ii=1:3
% Checking to see if scrolling should allowed, depths have to increase
% as layer number increase.
num1=alldep(ii); num2=alldep(ii+1);
if(num1==str2num(nullval)|num2==str2num(nullval))
if(num1==str2num(nullval))
if(ii==3)
jj=ii;
else
jj=1;
end
else
jj=ii+1;
end
controlout={['Layer: ' num2str(nm+ii+1) ' needs a depth or be deleted before scrolling can continue'] jj};
break
end
if(num1>=num2)
if(ii==3)
jj=ii;
else
jj=1;
end
controlout={['Layer: ' num2str(nm+ii+1) ' needs to be deeper then than Layer: ' num2str(nm+ii)] jj};
break
end
end
if(alldep(1)==nullval&controlout{2}==0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -