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

📄 mat2asc.m,v

📁 具有特色的地震数据处理源码
💻 M,V
字号:
head	3.0;access;symbols;locks; strict;comment	@// @;3.0date	2000.06.13.19.20.38;	author gilles;	state Exp;branches;next	2.0;2.0date	99.05.21.18.45.52;	author mah;	state Exp;branches;next	1.2;1.2date	99.03.29.17.08.37;	author eadam;	state Exp;branches;next	1.1;1.1date	99.01.06.19.09.04;	author kay;	state Exp;branches;next	;desc@@3.0log@Release 3@text@function mat2asc(datain,rec,datfile,thfile,fhfile)%mat2asc(datain,rec,datfile,thfile,fhfile)%mat2asc(datain,rec,datfile,thfile)%mat2asc(datain,rec,datfile)%%This function saves a DSI variable as three separate ascii files.%One file is for the file header, one for the trace headers, and%one for the seismic traces.  Only one record is saved.%%INPUT%datain - data in DSI format%rec - record number to write out to file%datfile, thfile and fhfile - file names for storing data, trace headers,%and file header respectivly.  All file names must be enclosed in single%quotes.  Files will be saved in your current directory unless a path is%specified with the filenames.%%DSI customized VSP processing software%written by K.S. Beaty June 1998%$Id: mat2asc.m,v 2.0 1999/05/21 18:45:52 mah Exp gilles $%$Log: mat2asc.m,v $%Revision 2.0  1999/05/21 18:45:52  mah%Release 2%%Revision 1.2  1999/03/29 17:08:37  eadam%Added fclose statements for datfile and thfile.,%%Revision 1.1  1999/01/06 19:09:04  kay%Initial revision%%%Copyright (C) 1998 Seismology and Electromagnetic Section/%Continental Geosciences Division/Geological Survey of Canada%%This library is free software; you can redistribute it and/or%modify it under the terms of the GNU Library General Public%License as published by the Free Software Foundation; either%version 2 of the License, or (at your option) any later version.%%This library is distributed in the hope that it will be useful,%but WITHOUT ANY WARRANTY; without even the implied warranty of%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%Library General Public License for more details.%%You should have received a copy of the GNU Library General Public%License along with this library; if not, write to the%Free Software Foundation, Inc., 59 Temple Place - Suite 330,%Boston, MA  02111-1307, USA.%%DSI Consortium%Continental Geosciences Division%Geological Survey of Canada%615 Booth St.%Ottawa, Ontario%K1A 0E9%%email: dsi@@cg.nrcan.gc.cadisp('mat2asc(datain,rec,datfile,thfile,fhfile)');msg1='\nThe file "';msg2='" exists already.  Overwrite this file? y for yes, n for no.\n';%save dataif exist(datfile)==2 %if file exists already yn=input([msg1,datfile,msg2],'s'); if ~strcmp(yn,'y')  return; end %ifend %ifformat=' %12f';matformat=format;for i=1:datain.th{rec}(12,1)-1 %loop over traces matformat=[matformat,format];end %loop over tracesmatformat=[matformat,'\n'];datfid=fopen(datfile,'w');if datfid==-1 error(['Could not open file ',datfile,'.'])end %iffprintf(datfid,matformat,datain.dat{rec}');fclose(datfid);
if nargin==3 returnend %if%save trace headersif exist(thfile)==2 %if file exists already yn=input([msg1,thfile,msg2],'s'); if ~strcmp(yn,'y')  return; end %ifend %ifthfid=fopen(thfile,'w');if thfid==-1 error(['Could not open file ',thfile,'.'])end %if%th=datain.th{rec}';fprintf(thfid,matformat,datain.th{rec}');
fclose(thfid);if nargin==4 returnend %if%save file headerif exist(fhfile)==2 %if file exists already yn=input([msg1,fhfile,msg2],'s'); if ~strcmp(yn,'y')  return; end %ifend %iffor i=length(datain.fh):-1:1 fhmat(i,1)=datain.fh{i};end %convert file header to matrixfhmat(1,1)=datain.th{rec}(12,1); %change number of traces in filefhmat(13,1)=fhmat(1,1); %max record foldfhmat(12,1)=1; %number of records in fileeval(['save ',fhfile,' fhmat -ascii'])@2.0log@Release 2@text@d22 1a22 1%$Id: mat2asc.m,v 1.2 1999/03/29 17:08:37 eadam Exp mah $d24 3@1.2log@Added fclose statements for datfile and thfile.,@text@d22 1a22 1%$Id: mat2asc.m,v 1.1 1999/01/06 19:09:04 kay Exp $d24 3@1.1log@Initial revision@text@d22 4a25 2%$Id:$%$Log:$d27 1d79 1d98 2a99 1fprintf(thfid,matformat,datain.th{rec}');@

⌨️ 快捷键说明

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