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

📄 get_filename4r.m

📁 地震、测井方面matlab代码,解释的比较详细
💻 M
字号:
function [selected_file,ierr]=get_filename4r(ext)
% Function interactively gets a file name with extension ext for reading a data set
% Written by: E. R., December 13, 2000
% Last updated: August 16, 2003; display file name only if not compiled; second
%              output argument
%
%              [selected_file,ierr]=get_filename4r(ext)
% INPUT
% ext          file extension. Extensions for which paths are defined are: 
%              'sgy','log','tbl','mat'.   Default: 'mat'
%              This extension is used to choose the initial directory path
%              and to show only files with this extension. Both can be changed 
%              in the file selector box
% OUTPUT
% selected_file  filename including path
%              global variables: S4M.filename   name of the file selected
%                                S4M.pathname   name of the path selected
%                                ABORTED (same as ierr)
%              this means that   selected_file = [S4M.pathname,S4M.pathname]
% ierr         error indicator: logical(1) if error
% GLOBAL VARIABLE
%              The filename is stored in  S4M.filename
%              the path name in S4M.pathname;


global ABORTED S4M

if isempty(S4M)
   presets
end

if nargin == 0
  ext='mat';
end

ierr=logical(0);

%        Open file selector window
if strcmpi(ext,'sgy')
   filter_spec=[S4M.seismic_path,'*.sgy;*.segy'];
   dialogue='Read SEG-Y file';
elseif strcmpi(ext,'mat')
   filter_spec=[S4M.mat_path,'*.mat'];
   dialogue='Read MAT file';
elseif strcmpi(ext,'las')
   filter_spec=[S4M.log_path,'*.las'];
   dialogue='Read LAS file';
elseif strcmpi(ext,'tbl')
   filter_spec=[S4M.table_path,'*.tbl;*.txt;*.dat;*.asc'];
   dialogue='Read TABLE to file';
else
   filter_spec=[S4M.default_path,ext];
   dialogue='Select file for input';
end 

[filename,pathname]=uigetfile(filter_spec,dialogue);
drawnow
if filename == 0;
   uiwait(errordlg(' No file selected. Task terminated',S4M.name,'modal'))
   selected_file='';
   ierr=logical(1);
   ABORTED=logical(1);
   return;
end
selected_file=[pathname,filename];
if ~S4M.compiled
   disp(['File    ',selected_file,'    interactively selected']);
end

%   	Set path name to the path just used
if strcmpi(ext,'sgy')
   S4M.seismic_path=pathname;
elseif strcmpi(ext,'mat')
   S4M.mat_path=pathname;
elseif strcmpi(ext,'las')
   S4M.log_path=pathname;
elseif strcmpi(ext,'tbl')
   S4M.table_path=pathname;
end 

S4M.filename=filename;
S4M.pathname=pathname;
ABORTED=logical(0);

⌨️ 快捷键说明

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