2aa68315
David Mayerich
major bug fixes f...
|
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
|
function M = enviLoadRaw(filename, headername)
%if a header isn't provided, assume it's just the filename
% with '.hdr' added to the end
if nargin == 1
headername = [filename '.hdr'];
end
h = enviLoadHeader(headername);
if strcmp(h.interleave, 'bsq')
X = h.samples;
Y = h.lines;
Z = h.bands;
elseif strcmp(h.interleave, 'bil')
X = h.samples;
Y = h.bands;
Z = h.lines;
else
X = h.bands;
Y = h.samples;
Z = h.lines;
end
fid = fopen(filename);
M = fread(fid, [X, Y*Z], '*float32');
M = reshape(M, [X, Y, Z]);
fclose(fid);
|