-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadSpectTraceHeader.m
More file actions
32 lines (26 loc) · 959 Bytes
/
Copy pathReadSpectTraceHeader.m
File metadata and controls
32 lines (26 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function [headers] = ReadSpectTraceHeader(filename);
%% Reads a .spect file and returns just the metadata
%
% Use: [headers] = ReadSpectTraceHeader(filename);
% -----------------------------------------------------------------------------
% Author:
% Keegan Lensink
% Seismic Laboratory for Imaging and Modeling
% Department of Earth, Ocean, and Atmospheric Sciences
% The University of British Columbia
%
% Date: March, 2017
% -----------------------------------------------------------------------------
% Open the file for reading
fid = fopen(filename,'r');
% Read the file header
file_header = fread(fid,[4,1],'double');
% Pull out metadata that will be used to read
ns = file_header(3);
ntraces = file_header(4);
% Calc byte to skip
bytespersample = 8;
toskip = ns*2*bytespersample;
% Now read all of the headers, real, and imag data
headers = fread(fid, [4,ntraces],'4*double=>double',toskip);
fclose(fid);