Blame view

matlab/loadAgilent.m 674 Bytes
48f356fa   David Mayerich   bug fixes for FFT...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  function S = loadAgilent(filename)
  
  fid = fopen(filename);          %open the file for reading
  fseek(fid, 9, 'bof');           %skip past the first 9 bytes of the header
  
  bands = fread(fid, 1, 'int16'); %read the number of bands in the file
  fseek(fid, 13, 'cof');          %skip the next 13 bytes in the header
  
  samples = fread(fid, 1, 'int16');   %read the number of samples (X)
  lines = fread(fid, 1, 'int16');     %read the number of lines (Y)
  
  fseek(fid, 1020, 'bof');            %skip past the entire header
  S = fread(fid, [samples lines*bands], 'float32');   %read all the data
  S = reshape(S, [samples, lines, bands]);
  fclose(fid);                    %close the file