function sac = rdsac(varargin)
format long;
varargin{1};
% % % % fnn=cell2mat(varargin{1});
fid=fopen(varargin{1},'r');%打开SAC文件垂直向
% % % % fid=fopen(varargin,'r');%打开SAC文件垂直向
%读文件1-70为浮点数32位
%[delta,count]=fread(fid,70,'float32')
%读文件71-111为长整数32位
%[delta,count]=fread(fid,40,'int32')
%以下为字符,每个8位
%[delta,count]=fread(fid,8,'uchar')
%Name: sac.h
%Purpose: structure for header of a SAC (Seismic Analysis Code) data file
%Notes: Key to comment flags describing each field:
% Column 1:
% R = required by SAC
% = (blank) optional
% Column 2:
% A = settable from a priori knowledge
% D = available in data
% F = available in or derivable from SEED fixed data header
% T = available in SEED header tables
% = (blank) not directly available from SEED data, header
% tables, or elsewhere
sac.delta=fread(fid,1,'float32'); % RF time increment, sec */
sac.depmin=fread(fid,1,'float32'); % minimum amplitude */
sac.depmax=fread(fid,1,'float32'); % maximum amplitude */
sac.scale=fread(fid,1,'float32'); % amplitude scale factor */
sac.odelta=fread(fid,1,'float32'); % observed time inc */
sac.b=fread(fid,1,'float32'); % RD initial value, ampl. */
sac.e=fread(fid,1,'float32'); % RD final value, amplitude */
sac.o=fread(fid,1,'float32'); % event start, sec > 0 */
sac.a=fread(fid,1,'float32'); % 1st arrival time */
sac.internal1=fread(fid,1,'float32'); % internal use */
sac.t0=fread(fid,1,'float32'); % user-defined time pick */
sac.t1=fread(fid,1,'float32'); % user-defined time pick */
sac.t2=fread(fid,1,'float32'); % user-defined time pick */
sac.t3=fread(fid,1,'float32'); % user-defined time pick */
sac.t4=fread(fid,1,'float32'); % user-defined time pick */
sac.t5=fread(fid,1,'float32'); % user-defined time pick */
sac.t6=fread(fid,1,'float32'); % user-defined time pick */
sac.t7=fread(fid,1,'float32'); % user-defined time pick */
sac.t8=fread(fid,1,'float32'); % user-defined time pick */
sac.t9=fread(fid,1,'float32'); % user-defined time pick */
sac.f=fread(fid,1,'float32'); % event end, sec > 0 */
sac.resp0=fread(fid,1,'float32'); % instrument respnse parm*/
sac.resp1=fread(fid,1,'float32'); % instrument respnse parm*/
sac.resp2=fread(fid,1,'float32'); % instrument respnse parm*/
sac.resp3=fread(fid,1,'float32'); % instrument respnse parm*/
sac.resp4=fread(fid,1,'float32'); % instrument respnse parm*/
sac.resp5=fread(fid,1,'float32'); % instrument respnse parm*/
sac.resp6=fread(fid,1,'float32'); % instrument respnse parm*/
sac.resp7=fread(fid,1,'float32'); % instrument respnse parm*/
sac.resp8=fread(fid,1,'float32'); % instrument respnse parm*/
sac.resp9=fread(fid,1,'float32');% instrument respnse parm*/
sac.stla=fread(fid,1,'float32');% T station latititude */
sac.stlo=fread(fid,1,'float32');% T station longitude */
sac.stel=fread(fid,1,'float32');% T station elevation, m */
sac.stdp=fread(fid,1,'float32');% T station depth, m */
sac.evla=fread(fid,1,'float32');% event latitude */
sac.evlo=fread(fid,1,'float32');% event longitude */
sac.evel=fread(fid,1,'float32');% event elevation */
sac.evdp=fread(fid,1,'float32');% event depth */
sac.unused1=fread(fid,1,'float32');% reserved for future use*/
sac.user0=fread(fid,1,'float32');% available to user */
sac.user1=fread(fid,1,'float32');% available to user */
sac.user2=fread(fid,1,'float32');% available to user */
sac.user3=fread(fid,1,'float32');% available to user */
sac.user4=fread(fid,1,'float32');% available to user */
sac.user5=fread(fid,1,'float32');% available to user */
sac.user6=fread(fid,1,'float32');% available to user */
sac.user7=fread(fid,1,'float32');% available to user */
sac.user8=fread(fid,1,'float32');% available to user */
sac.user9=fread(fid,1,'float32');% available to user */
sac.dist=fread(fid,1,'float32');% stn-event distance, km */
sac.az=fread(fid,1,'float32');% event-stn azimuth */
sac.baz=fread(fid,1,'float32');% stn-event azimuth */
sac.gcarc=fread(fid,1,'float32');% stn-event dist, degrees*/
sac.internal2=fread(fid,1,'float32');% internal use */
sac.internal3=fread(fid,1,'float32');% internal use */
sac.depmen=fread(fid,1,'float32');% mean value, amplitude */
sac.cmpaz=fread(fid,1,'float32');% T component azimuth */
sac.cmpinc=fread(fid,1,'float32');% T component inclination */
sac.unused2=fread(fid,1,'float32');% reserved for future use*/
sac.unused3=fread(fid,1,'float32');% reserved for future use*/
sac.unused4=fread(fid,1,'float32');% reserved for future use*/
sac.unused5=fread(fid,1,'float32');% reserved for future use*/
sac.unused6=fread(fid,1,'float32');% reserved for future use*/
sac.unused7=fread(fid,1,'float32');% reserved for future use*/
sac.unused8=fread(fid,1,'float32');% reserved for future use*/
sac.unused9=fread(fid,1,'float32');% reserved for future use*/
sac.unused10=fread(fid,1,'float32');% reserved for future use*/
sac.unused11=fread(fid,1,'float32');% reserved for future use*/
sac.unused12=fread(fid,1,'float32');% reserved for future use*/
sac.nzyear=fread(fid,1,'int32');% F zero time of file, yr
sac.nzjday=fread(fid,1,'int32');% F zero time of file, da
sac.nzhour=fread(fid,1,'int32');% F zero time of file, hr
sac.nzmin=fread(fid,1,'int32');% F zero time of file, mi
sac.nzsec=fread(fid,1,'int32');% F zero time of file, se
sac.nzmsec=fread(fid,1,'int32');% F zero time of file, ms
sac.internal4=fread(fid,1,'int32');% internal use */
sac.internal5=fread(fid,1,'int32');% internal use */
sac.internal6=fread(fid,1,'int32');% internal use */
sac.npts=fread(fid,1,'int32');% RF number of samples */
sac.internal7=fread(fid,1,'int32');% internal use */
sac.internal8=fread(fid,1,'int32');% internal use */
sac.unused13=fread(fid,1,'int32');% reserved for future use*/
sac.unused14=fread(fid,1,'int32');% reserved for future use*/
sac.unused15=fread(fid,1,'int32');% reserved for future use*/
sac.iftype=fread(fid,1,'int32');% RA type of file */
sac.idep=fread(fid,1,'int32');% type of amplitude */
sac.iztype=fread(fid,1,'int32');% zero time equivalence */
sac.unused16=fread(fid,1,'int32');% reserved for future use*/
sac.iinst=fread(fid,1,'int32');% recording instrument */
sac.istreg=fread(fid,1,'int32');% stn geographic region */
sac.ievreg=fread(fid,1,'int32');% event geographic region*/
sac.ievtyp=fread(fid,1,'int32');% event type */
sac.iqual=fread(fid,1,'int32');% quality of data */
sac.isynth=fread(fid,1,'int32');% synthetic data flag */
sac.unused17=fread(fid,1,'int32');% reserved for future use*/
sac.unused18=fread(fid,1,'int32');% reserved for future use*/
sac.unused19=fread(fid,1,'int32');% reserved for future use*/
sac.unused20=fread(fid,1,'int32');% reserved for future use*/
sac.unused21=fread(fid,1,'int32');% reserved for future use*/
sac.unused22=fread(fid,1,'int32');% reserved for future use*/
sac.unused23=fread(fid,1,'int32');% reserved for future use*/
sac.unused24=fread(fid,1,'int32');% reserved for future use*/
sac.unused25
评论0