Can someone help me to explain/understand this code
Mostrar comentarios más antiguos
if nargin==0, [file,pathname]=uigetfile('*.las'); else pathname=''; end;
if ischar(file)
fid=fopen([pathname,file]);
k=0; header=''; colblock=0; datablock=0;
while ~datablock
jline=fgetl(fid);
if ~ischar(jline), break, end;
header=strvcat(header,jline);
if any(strmatch('~A',upper(jline))), colblock=0; datablock=1; end;
if colblock&any(strmatch('~',upper(jline))), colblock=0; end;
if colblock & ~strcmp(jline(1),'#'),
k=k+1; colnames{k}=strtok(jline);
end;
if any(strmatch('~CURVE',upper(jline))), colblock=1; datablock=0; end;
end;
disp(' ');
disp(['Reading data for ' num2str(k) ' log curves from ' file])
data=fscanf(fid,'%f');
data=reshape(data,[k length(data)/k])';
fclose(fid);
data(data<=-999)=nan;
colnames=regexprep(colnames,'\W','_');
colnames=lower(colnames);
datastr.header=header;
for k=1:length(colnames)
datastr = setfield(datastr,colnames{k},data(:,k));
2 comentarios
Jan
el 1 de Jun. de 2021
Please do not remove the question after answers have been given.
Nisar Ahmed
el 4 de Jun. de 2021
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Standard File Formats en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!