Commit d32e44f6 authored by Jürgen Matzka's avatar Jürgen Matzka
Browse files
parents 3f7ef5f5 cb7e7e5f
clearvars DI
DI=[];
% -------------------------------------------------------------------------
% Read from BFO ASCII
% -------------------------------------------------------------------------
file_ascii='O:\jmat\0DI_measurements\DI_BFO2018\Messprotokolle\Messung_180411d';
fid=fopen(file_ascii);
while ~feof(fid)
% Read line
fline=fgets(fid);
% Split at ':'
C=strtrim(strsplit(fline,':'));
% Exit if no value present
if length(C)<2; continue; end;
% Replace spaces
C{1}=strrep(C{1},' ','_');
C{1}=strrep(C{1},'(','');
C{1}=strrep(C{1},')','');
% Check for keywords
if length(C)==2
if ~isfield(DI,C{1})
N=0;
else
N=length(DI.(C{1}));
end
DI.(C{1}){N+1}=C{2};
elseif (length(C)==3)
C{2}=strrep(C{2},' ','_');
C{2}=strrep(C{2},'(','');
C{2}=strrep(C{2},')','');
if ~isfield(DI,C{1}) || ~isfield(DI.(C{1}),C{2})
N=0;
else
N=length(DI.(C{1}).(C{2}));
end
DI.(C{1}).(C{2}){N+1}=C{3};
end
end
fclose(fid);
% -------------------------------------------------------------------------
% Write to XLS
% -------------------------------------------------------------------------
file_xls_default='O:\jmat\0DI_measurements\DI_BFO2018\DI_BFO_vorlage.xls';
file_xls=[ fileparts(file_ascii) '\DI_BFO_' DI.Date{1}([1:4 6:7 9:10]) ...
DI.DDD_East_up{1}([1:2 4:5]) '.xls'];
disp([ 'Copy DI measurements from ' file_ascii ' to ' file_xls ]);
copyfile(file_xls_default,file_xls);
% Station / Year / Date
A={ 'BFO' str2double(DI.Date{1}(1:4)) str2double(DI.Date{1}([6:7 9:10])) };
xlswrite(file_xls,A,'A8:C8');
clearvars A
% Observer
switch (DI.Observer{1})
case 'Rudolf Widmer-Schnidrig'
A{1}='wsc';
case 'Achim Morschhauser'
A{1}='mors';
otherwise
error(['Unknown observer: ' DI.Observer{1}]);
end
A{2}=3;
xlswrite(file_xls,A,'E8:F8');
clearvars A
% Pillar
switch (DI.Pilar{1})
case 'YTONG'
A{1}='1';
otherwise
error(['Unknown pilar: ' DI.Pilar{1}]);
end
clearvars A
% Temperature
A=str2double(DI.Room_temperature_C);
xlswrite(file_xls,A,'J57:J57');
clearvars A
% Azimuth marks
for i=1:2
tmp=strsplit(DI.BBB_Target.Beton_down{i},' ');
A{1}=str2double(tmp{1})+str2double(tmp{2})/100;
tmp=strsplit(DI.BBB_Target.Rock_down{i},' ');
A{2}=str2double(tmp{1})+str2double(tmp{2})/100;
tmp=strsplit(DI.BBB_Target.Beton_up{i},' ');
A{3}=str2double(tmp{1})+str2double(tmp{2})/100;
tmp=strsplit(DI.BBB_Target.Rock_up{i},' ');
A{4}=str2double(tmp{1})+str2double(tmp{2})/100;
if i==1
xlswrite(file_xls,A,'A13:D13');
else
xlswrite(file_xls,A,'A31:D31');
end
end
clearvars A
% Declination measurement
for i=1:2
tmp=strsplit(DI.DDD_East_up{i},' ');
UTHC(i,1)=str2double(tmp{1})*1e4+str2double(tmp{2})*1e2+str2double(tmp{3});
UTHC(i,2)=str2double(tmp{4})+str2double(tmp{5})/100;
R(i)=str2double(tmp{6});
tmp=strsplit(DI.DDD_West_up{i},' ');
UTHC(2+i,1)=str2double(tmp{1})*1e4+str2double(tmp{2})*1e2+str2double(tmp{3});
UTHC(2+i,2)=str2double(tmp{4})+str2double(tmp{5})/100;
R(2+i)=str2double(tmp{6});
tmp=strsplit(DI.DDD_East_down{i},' ');
UTHC(4+i,1)=str2double(tmp{1})*1e4+str2double(tmp{2})*1e2+str2double(tmp{3});
UTHC(4+i,2)=str2double(tmp{4})+str2double(tmp{5})/100;
R(4+i)=str2double(tmp{6});
tmp=strsplit(DI.DDD_West_down{i},' ');
UTHC(6+i,1)=str2double(tmp{1})*1e4+str2double(tmp{2})*1e2+str2double(tmp{3});
UTHC(6+i,2)=str2double(tmp{4})+str2double(tmp{5})/100;
R(6+i)=str2double(tmp{6});
end
xlswrite(file_xls,UTHC,'B19:C26');
xlswrite(file_xls,R','E19:E26');
% Inclination measurement
for i=1:2
tmp=strsplit(DI.III_North_up{i},' ');
UT(i)=str2double(tmp{1})*1e4+str2double(tmp{2})*1e2+str2double(tmp{3});
VCR(i,1)=str2double(tmp{4})+str2double(tmp{5})/100;
VCR(i,2)=str2double(tmp{6});
tmp=strsplit(DI.III_South_down{i},' ');
UT(2+i)=str2double(tmp{1})*1e4+str2double(tmp{2})*1e2+str2double(tmp{3});
VCR(2+i,1)=str2double(tmp{4})+str2double(tmp{5})/100;
VCR(2+i,2)=str2double(tmp{6});
tmp=strsplit(DI.III_North_down{i},' ');
UT(4+i)=str2double(tmp{1})*1e4+str2double(tmp{2})*1e2+str2double(tmp{3});
VCR(4+i,1)=str2double(tmp{4})+str2double(tmp{5})/100;
VCR(4+i,2)=str2double(tmp{6});
tmp=strsplit(DI.III_South_up{i},' ');
UT(6+i)=str2double(tmp{1})*1e4+str2double(tmp{2})*1e2+str2double(tmp{3});
VCR(6+i,1)=str2double(tmp{4})+str2double(tmp{5})/100;
VCR(6+i,2)=str2double(tmp{6});
end
i=3;
tmp=strsplit(DI.III_South_up{4},' ');
UT(6+i)=str2double(tmp{1})*1e4+str2double(tmp{2})*1e2+str2double(tmp{3});
VCR(6+i,1)=str2double(tmp{4})+str2double(tmp{5})/100;
VCR(6+i,2)=str2double(tmp{6});
xlswrite(file_xls,UT','B37:B45');
xlswrite(file_xls,VCR,'D37:E45');
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment