⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 segymat.m

📁 matlab源程序
💻 M
📖 第 1 页 / 共 2 页
字号:
  drawnow;  % --------------------------------------------------------------------function KeyPressFcn_Callback(hObject, eventdata, handles)data=guidata(hObject);Key=get(gcf,'CurrentCharacter');%SegymatVerbose(['GUI : KeyPressFcn :  ',num2str(double(Key)),' ',char(Key)],20)%disp(char(Key));%disp(double(Key));%%%%%%%%%%%% GAIN%if (Key=='+'),if ((double(Key)==30)|(double(Key)==43)|(double(Key)==115))    data.PlotPref.caxis=data.PlotPref.caxis./(1.2);    guidata(hObject,data);    UpdateGain(hObject, eventdata, handles) ;end%if (Key=='-');if ((double(Key)==31)|(double(Key)==45)|(double(Key)==120))    data.PlotPref.caxis=data.PlotPref.caxis.*(1.2);    guidata(hObject,data);    UpdateGain(hObject, eventdata, handles) ;end%% SHOW PREFSif (lower(Key)=='h')    if isfield(data.PlotPref,'Show')==0, data.PlotPref.Show=1;end    data.PlotPref.Show=1-data.PlotPref.Show;    guidata(hObject,data);    fMain_ResizeFcn(hObject,[],handles);end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ZOOM ON MAIN AXif isfield(data,'zoomfac')==0    data.zoomfac=1.5;    guidata(hObject,data);end if ((double(Key)==29)|(double(Key)==97)) % ARROW RIGHT OR 'a'    %disp('Zoom in')    zoom(data.zoomfac)endif ((double(Key)==28)|(double(Key)==122)) % ARROW LEFT OR 'z'    %disp('Zoom out')    zoom(1./data.zoomfac)end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MOVEif isfield(data,'movefac')==0    % Movefac=1; move in stepos of size of window    % Movefac=0.5; move in steps of half-size of window    data.movefac=.02;    guidata(hObject,data);end if (double(Key)>=49)&(double(Key)<60), % NUM PAD  xlim=get(handles.axMain,'Xlim');  ylim=get(handles.axMain,'Ylim');  wx=(xlim(2)-xlim(1)).*data.movefac;  wy=(ylim(2)-ylim(1)).*data.movefac;  if (double(Key)==56), set(handles.axMain,'Ylim',ylim-wy); end % 8  if (double(Key)==50), set(handles.axMain,'Ylim',ylim+wy); end % 2  if (double(Key)==52), set(handles.axMain,'Xlim',xlim-wx); end % 4   if (double(Key)==54), set(handles.axMain,'Xlim',xlim+wx); end % 6  if (double(Key)==49),     set(handles.axMain,'Ylim',ylim+wy);     set(handles.axMain,'Xlim',xlim-wx);  end % 1  if (double(Key)==51),     set(handles.axMain,'Ylim',ylim+wy);     set(handles.axMain,'Xlim',xlim+wx);  end % 3  if (double(Key)==55),     set(handles.axMain,'Ylim',ylim-wy);     set(handles.axMain,'Xlim',xlim-wx);  end % 7  if (double(Key)==57),     set(handles.axMain,'Ylim',ylim-wy);     set(handles.axMain,'Xlim',xlim+wx);  end % 9  if (double(Key)==53),     axes(handles.axMain)    zoom out;      end % 5  xlim_after=get(handles.axMain,'Xlim');  if (sum(xlim==xlim_after)<2)    UpdateTopPlot(hObject, eventdata, handles)    UpdateBotPlot(hObject, eventdata, handles)  endend % --------------------------------------------------------------------function mFile_Callback(hObject, eventdata, handles)% hObject    handle to mFile (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function mFileOpen_Callback(hObject, eventdata, handles)% hObject    handle to mFileOpen (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)%[file,path]=uigetfile( ...%    {'*.segy;*.SEGY;*.SEGY;*.sgy','All Segy files'; ...%     '*.su;*.SU;*.sU;*.Su','All SU files'; ...%     '*','All Files'},...%    'Pick A file');data=guidata(hObject);%  keyboardsegyfile=DIAOpenSEGY;%keyboard[data.SegyData,data.SegyTraceHeaders,data.SegyHeader]=ReadSegy(fullfile(segyfile.pathname,segyfile.filename));data.SegyTime=[1:1:data.SegyHeader.ns].*data.SegyHeader.dt/1e+6;data.SegyTrace=[1:length(data.SegyTraceHeaders)];data.PlotPref.Show=1;data.PlotPref.caxis=[min(data.SegyData(:)) max(data.SegyData(:))];guidata(hObject,data);fMain_ResizeFcn(hObject, eventdata, handles);UpdatePrefs(hObject, eventdata, handles);UpdatePlots(hObject, eventdata, handles);% --------------------------------------------------------------------function mFileSave_Callback(hObject, eventdata, handles)% hObject    handle to mFileSave (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function mHelp_Callback(hObject, eventdata, handles)% hObject    handle to mHelp (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function mHelpHelp_Callback(hObject, eventdata, handles)% hObject    handle to mHelpHelp (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function mHelpAbout_Callback(hObject, eventdata, handles)% hObject    handle to mHelpAbout (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)segymat_about;2% --- Executes on button press in pbGainUp.function pbGainUp_Callback(hObject, eventdata, handles)% hObject    handle to pbGainUp (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)  data=guidata(hObject);  data.PlotPref.caxis=data.PlotPref.caxis./(1.2);  guidata(hObject,data);  UpdateGain(hObject, eventdata, handles) ;% --- Executes on button press in pbGainDown.function pbGainDown_Callback(hObject, eventdata, handles)% hObject    handle to pbGainDown (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)  data=guidata(hObject);  data.PlotPref.caxis=data.PlotPref.caxis.*(1.2);  guidata(hObject,data);  UpdateGain(hObject, eventdata, handles) ;  % --- Executes during object creation, after setting all properties.function eGainMin_CreateFcn(hObject, eventdata, handles)% hObject    handle to eGainMin (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction eGainMin_Callback(hObject, eventdata, handles)% hObject    handle to eGainMin (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of eGainMin as text%        str2double(get(hObject,'String')) returns contents of eGainMin as a doubledata=guidata(hObject);data.PlotPref.caxis(1)=str2double(get(hObject,'String'));guidata(hObject,data);UpdateGain(hObject, eventdata, handles);% --- Executes during object creation, after setting all properties.function eGainMax_CreateFcn(hObject, eventdata, handles)% hObject    handle to eGainMax (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction eGainMax_Callback(hObject, eventdata, handles)% hObject    handle to eGainMax (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of eGainMax as text%        str2double(get(hObject,'String')) returns contents of eGainMax as a doubledata=guidata(hObject);data.PlotPref.caxis(2)=str2double(get(hObject,'String'));guidata(hObject,data);UpdateGain(hObject, eventdata, handles);% --- Executes during object creation, after setting all properties.function popTop_CreateFcn(hObject, eventdata, handles)% hObject    handle to popTop (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popTop.function popTop_Callback(hObject, eventdata, handles)% hObject    handle to popTop (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popTop contents as cell array%        contents{get(hObject,'Value')} returns selected item from popTop  SegymatVerbose(['GUI : Update popTOP'],20)  UpdateTopPlot(hObject, eventdata, handles)% --- Executes during object creation, after setting all properties.function popBot_CreateFcn(hObject, eventdata, handles)% hObject    handle to popBot (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popBot.function popBot_Callback(hObject, eventdata, handles)% hObject    handle to popBot (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popBot contents as cell array%        contents{get(hObject,'Value')} returns selected item from popBot  SegymatVerbose(['GUI : Update popBOT'],20)  UpdateBotPlot(hObject, eventdata, handles)% --- Executes during object creation, after setting all properties.function popColormap_CreateFcn(hObject, eventdata, handles)% hObject    handle to popColormap (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popColormap.function popColormap_Callback(hObject, eventdata, handles)% hObject    handle to popColormap (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popColormap contents as cell array%        contents{get(hObject,'Value')} returns selected item from popColormap  SegymatVerbose(['GUI : Update popColormap'],20)  data=guidata(hObject);  cmap=get(hObject,'String');  icmap=get(hObject,'value');  axes(handles.axMain);  colormap(cmap{icmap});  zoom on;  % --- Executes during object creation, after setting all properties.function popStyle_CreateFcn(hObject, eventdata, handles)% hObject    handle to popStyle (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popStyle.function popStyle_Callback(hObject, eventdata, handles)% hObject    handle to popStyle (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popStyle contents as cell array%        contents{get(hObject,'Value')} returns selected item from popStyle  SegymatVerbose(['GUI : popStyle'],20)  UpdateMainPlot(hObject, eventdata, handles);  UpdateTopPlot(hObject, eventdata, handles)  UpdateBotPlot(hObject, eventdata, handles)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -