segy_writetextheader.m

来自「基于matlab的反演程序,用于地球物理勘探中射线追踪及偏移成像程序.」· M 代码 · 共 43 行

M
43
字号
function SEGY_WriteTextHeader(FILE, thead, format)
% SEGY_WRITETEXTHEADER(FILE, thead, format)
%
% This function writes a text header 'thead' to the file FILE with the
% 'format', where 'format' is either 'ebcdic' or 'ascii'. 'format' is an
% optional argument, and if unspecified will default to 'ascii'. You can
% retrieve a valid text header from the function GETTEXTHEADER. It is
% wise to get a text header from this function and then edit it as you
% see fit.
%
% This function will OVERWRITE whatever text header may be existing in
% the file. 
%
% Chad Hogan, 2004
% 
% $Id: SEGY_WriteTextHeader.m,v 1.1 2004/06/18 21:24:29 cmhogan Exp $

if nargin < 3
    format = 'ascii';
end

if strcmp(lower(format), 'ebcdic')
    thead = ascii2ebcdic(thead);
end
    

if length(thead) ~= 3200
    error('input text header must be exactly 3200 bytes long');
    return
end

fseek(FILE, 0, 'bof'); % rewind the file to the very start

if(fwrite(FILE, thead) ~= 3200)
    disp(ferror(FILE))
    error('writing failed');
end





⌨️ 快捷键说明

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