loadrd3.m

来自「于探地雷达的matlab正演程序」· M 代码 · 共 41 行

M
41
字号
function [A,samples,traces] = loadrd3%LOADRD3 loads radar profiles from a ramac format file. %%Usage:%A = loadrd3;  opens an "open file" dialog box to interactively choose%file. Matrix A is created. rows of A have common two-way-travel-time,%columns of A have common profile station.  %%[A,samples,traces] = loadrd3;  will return matrix A and variables%"sapmples" and "traces", which contain the dimensions of A.%Copyright: (c) Brian Barret, 2004%Glaciology Group, School of Geography, University of Leeds%ask for file to load - automatically determines header file[dat,pathname]= uigetfile ('*.rd3', 'Load Ramac format radar file');name=double(dat);chrctrs=size(name);header=char([name(1:chrctrs(2)-2),97,100]);%open header file - find number of samples and number of tracesfid=fopen([pathname,header],'r');for k=1:30   % Read the Header   line=fgetl(fid);      if ~isempty(findstr('SAMPLES:',line))            pt=findstr('SAMPLES:',line);      samples=str2num(line(pt+8:length(line)));   end   if ~isempty(findstr('LAST TRACE:',line))      pt=findstr('LAST TRACE:',line);      traces=str2num(line(pt+11:length(line)));   endendfclose(fid);%close header%open datafid=fopen([pathname,dat],'r');A=fread(fid,[samples,traces],'int16');fclose(fid);

⌨️ 快捷键说明

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