?? readmatrix.m
字號:
function partmatrix=readMatrix(filename,firstPix,numPix,firstEcho,numEchos)
% ========================================================================
% Chirp Scaling Algorithm - read raw data matrix
% Maurice Rueegg
% April 2005
% ========================================================================
% Program to extract a part of a SUN raster file
% ========================================================================
% Copyright (c) Maurice Rueegg (2005)
% Permission to use these scripts for SAR processing and related research
% is granted. Please acknowledge the Remote Sensing Laboratories of the
% University of Zurich, Switzerland.
% The author disclaims any responsibility for or liability related to this
% Software. Any questions, complaints or claims related to the Software
% may be directed to mrueegg@geo.unizh.ch.
% ========================================================================
partmatrix=complex(zeros(numEchos,numPix));
% open the raster file and determine the file size from the header
fid=fopen(filename,'rb','ieee-be');
headerInts=fread(fid,8,'uint32');
ras_magic=headerInts(1);
ras_width=headerInts(2);
ras_height=headerInts(3);
ras_depth=headerInts(4);
ras_length=headerInts(5);
ras_type=headerInts(6);
ras_maptype=headerInts(7);
ras_maplength=headerInts(8);
bytesPerPixel=8;
valtype='float32';
disp('8 bytes per Pixel')
for k=1:firstEcho-1
[curEcho,read_count]=fread(fid,ras_width*2,[valtype,'=>double']);
end
numzeros=0;
nonzeros=0;
for k=1:numEchos
[curEcho,read_count]=fread(fid,[1,ras_width*2],valtype);
if read_count<ras_width*2
error(['read only ',num2str(read_count),' numbers instead of ',...
num2str(ras_width*2)])
end
im_range=2*firstPix:2:2*(firstPix-1+numPix);
re_range=im_range-1;
partmatrix(k,:)=(curEcho(re_range)+curEcho(im_range).*j);
nonzeros=nonzeros+sum(abs(curEcho)>0);
numzeros=numzeros+sum(abs(curEcho)==0);
end
fclose(fid);
return
% = end ==================================================================
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -