📄 getcmp.m
字号:
function [traces,offset]=GetCMP(str,CMPNumber)
%
% Function to get a set of traces and their offset from a
% file containing a set of CMP (or other) traces that you
% have previously saved using the function putcmp.m
% This would be used to save your cmp gathers if you desire so
% that you do not have to resort the data repeatedly.
% str=string of 7 character ????000
% examples nCMP000 (note the 000 will be converted to the appropriate CMPnumber
% you want to call the gather)
% CMPNumber: integer CMP number
% traces should contain a CMP gather
% offset should contain offsets of the CMP gather
% To run [traces,offset]=GetCMP('stuf000',29)gets a file with the name stuf029.dat
%
%
nt=1250;
filename=str;
filename(8:11)='.dat';
s=num2str(CMPNumber);
if(CMPNumber<10);
str(7:7)=s
elseif (CMPNumber<100);
str(6:7)=s
elseif(CMPNumber<999)
str(5:7)=s;
else
'error'
break
end
fid=fopen(filename,'r','l');
fseek(fid,0,'eof');
n=ftell(fid);
ntraces=n/4/(nt+1);
fseek(fid,0,'bof');
traces=zeros(nt,ntraces);
offset=zeros(1,ntraces);
for i=1:ntraces
offset(i)=fread(fid,1,'float');
traces(:,i)=fread(fid,nt,'float');
end
fclose(fid);
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -