📄 v3d_import_res3dinv.m
字号:
function [x,y,z,v] = v3d_import_res3dinv(filename)
%
% Res3DInv Datei importieren
% --------------------------------------------------------------------
%
% Format der Datei:
%
% Kopf:
% -----
% 01: topoflagm 0
% 02: /Name of survey line is DATENSATZTITEL
% 03: /Number of blocks is BLOCKANZAHL
% 04-06: Kommentar
%
% Falls I.P. Werte gegeben folgt
% 07: /The I.P. is given in terms of Chargeability with units in Promille
% 08: / X Y Depth Resistivity Conductivity I.P.
%
% Falls keine IP-Werte gegeben folgt
% 07: / X Y Depth Resistivity Conductivity
%
% Daten:
% ------
%
% 8 Zeilen: Blockkoordinaten x y z getrennt durch Tabulator
% 2 Zeilen: uninteressant
% 1 Zeile : Mittelpunktkoordinaten x y z, Res, Con (und I.P.) getrennt durch Tabulatoren
% ...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fid=fopen(filename);
for i=1:8
zeile{i} = fgetl(fid);
end
fclose(fid);
% Test ob Res3DInv Datei
if (~strcmp(zeile{1},'topoflagm 0') & ~strcmp(zeile{2}(1:23),'/Name of survey line is') & ~strcmp(zeile{3}(1:20),'/Number of blocks is') & zeile{7}(1)~='/')
dlg=errordlg(['Res3DInv-Datei "' filename '" ist fehlerhaft!'],'Fehler');
waitfor(dlg);
x=0;y=0;z=0;v=0;
return;
end
% Infodialog 黚er einzulesenden Datensatz
dlginfo = questdlg({['Datei: ' filename],['Titel: ' zeile{2}(25:length(zeile{2}))],['Bl鯿ke: ' zeile{3}(22:length(zeile{3}))],['Iterationen: ' zeile{4}(24:length(zeile{4}))],'','Soll der Datensatz eingelesen werden?',''},'Res3DInv Inversionsdatei laden...','Ok','Abbruch','');
% Auswerten des Infodialoges
if strcmp(dlginfo,'Abbruch')
x=0;y=0;z=0;v=0;
return;
end
% ist erstes Zeichen der 8. Zeile ein '/', so sind I.P. Werte gegeben
% Dialog welcher Datensatz eingelesen werden soll
if zeile{8}(1)=='/'
ip=1;
dlgtyp = questdlg('Welche Daten wollen Sie einlesen?','Hinweis','spez. Widerstand','Leitf鋒igkeit','I.P.','');
else
ip=0;
dlgtyp = questdlg('Welche Daten wollen Sie einlesen?','Hinweis','spez. Widerstand','Leitf鋒igkeit','');
end
% Dialog ob Mittelpunktskoordianten oder Blockkoordinaten genutzt werden soll
dlgformat = questdlg('Welches Format soll der Datensatz haben?','Hinweis','Mittelpunkt','Block','');
% Formatdialog auswerten
if strcmp(dlgformat,'Mittelpunkt')
% Datens鋞ze einlesen
if (ip)
[xval yval zval resval conval ipval] = textread(filename,'%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%f %f %f %f %f %f','delimiter','\n','whitespace','','headerlines',8);
else
[xval yval zval resval conval] = textread(filename,'%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%f %f %f %f %f','delimiter','\n','whitespace','','headerlines',7);
end
% Vektoren drehen
zval=rot90(zval);
yval=rot90(yval);
xval=rot90(xval);
% sortieren nach Gr鲞e und doppelte entfernen
xx=unique(sort(xval));
yy=unique(sort(yval));
zz=unique(sort(zval));
% Matrix yy*xx*zz erstellen und mit NaN f黮len
vv=ones(length(yy),length(xx),length(zz))*NaN;
% Auswerten des Dialoges
if strcmp(dlgtyp,'spez. Widerstand')
dt=resval;
elseif strcmp(dlgtyp,'Leitf鋒igkeit')
dt=conval;
elseif strcmp(dlgtyp,'I.P.')
dt=ipval;
end
for t=1:length(dt)
i=find(xx==xval(t));
j=find(yy==yval(t));
k=find(zz==zval(t));
vv(j,i,k)=dt(t);
end
x=xx;
y=yy;
z=zz;
v=vv;
else
% Datens鋞ze einlesen
if (ip)
[x0 y0 z0 x1 y1 z1 resval conval ipval] = textread(filename,'%f %f %f%*s%*s%*s%*s%*s%f %f %f%*s%*s%*s%*f %*f %*f %f %f %f','delimiter','\n','whitespace','','headerlines',8);
else
[x0 y0 z0 x1 y1 z1 resval conval] = textread(filename,'%f %f %f%*s%*s%*s%*s%*s%f %f %f%*s%*s%*s%*f %*f %*f %f %f','delimiter','\n','whitespace','','headerlines',7);
end
% Vektoren drehen
zval=rot90(z0);
yval=rot90(y0);
xval=rot90(x0);
% sortieren nach Gr鲞e und doppelte entfernen
xx=unique(sort(xval));
yy=unique(sort(yval));
zz=unique(sort(zval));
% Matrix yy*xx*zz erstellen und mit NaN f黮len
vv=ones(length(yy),length(xx),length(zz))*NaN;
% Auswerten des Dialoges
if strcmp(dlgtyp,'spez. Widerstand')
dt=resval;
elseif strcmp(dlgtyp,'Leitf鋒igkeit')
dt=conval;
elseif strcmp(dlgtyp,'I.P.')
dt=ipval;
end
for t=1:length(dt)
i=find(xx==xval(t));
j=find(yy==yval(t));
k=find(zz==zval(t));
vv(j,i,k)=dt(t);
end
% Blockkoordinaten vervollst鋘digen
xx(length(xx)+1)=x1(length(x1));
yy(length(yy)+1)=y1(length(y1));
zz(length(zz)+1)=z1(length(z1));
[x,y,z,v]=v3d_import_block(xx,yy,zz,vv);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -