function distanceFun()
close all; clear all; clc;
filenameqx = 'E:\QTCode\build-SHNADataAnalysis-Desktop_Qt_5_14_0_MSVC2017_64bit-Debug\QX\QX.txt';
fid = fopen(filenameqx);
QX = textscan(fid,'%s');
fclose(fid);
strHoritionalQX=QX{1};
strHoritionalQX=str2double(strHoritionalQX(4:length(strHoritionalQX)));
filenamelf = 'E:\QTCode\build-SHNADataAnalysis-Desktop_Qt_5_14_0_MSVC2017_64bit-Debug\LF\LF.txt';
fidlf = fopen(filenamelf);
LF = textscan(fidlf,'%s');
fclose(fidlf);
strHoritionalLF=LF{1};
strHoritionalLF=str2double(strHoritionalLF(4:length(strHoritionalLF)));
m=length(strHoritionalQX);
mLF=length(strHoritionalLF);
horizontalQX = [];
indexQX =[];
horizontalLF = [];
indexLF =[];
standartHorizontal =[];
standartIndex = [];
for i=1:m
horizontalQX(i)=strHoritionalQX(i);
indexQX(i)=i;
standartHorizontal(i)=0;
standartIndex(i)=i;
end
for i=1:mLF
horizontalLF(i)=strHoritionalLF(i);
indexLF(i)=i;
end
%获取最大值和最小值
[QXMax,QXindex] = max(horizontalQX);
[LFMax,LFindex] = max(horizontalLF);
[QXmin,QXindexmin] = min(horizontalQX);
[LFmin,LFindexmin] = min(horizontalLF);
figure(3);
F1=plot(indexQX,horizontalQX,'g.-');
hold on
F2=plot(indexLF,horizontalLF,'b.-');
F3=plot(standartIndex,standartHorizontal,'r.-');
xlabel('time(s)');
ylabel('水平误差(m)');
if m>=mLF&&QXMax>=LFMax
axis([0,m,0,QXMax]);
elseif m>=mLF&&QXMax<=LFMax
axis([0, m ,0, LFMax]);
elseif m<=mLF&&QXMax>=LFMax
axis([0, mLF, 0, QXMax]);
elseif m<=mLF&&QXMax<=LFMax
axis([0 ,mLF, 0, LFMax]);
end
grid on; %应用分格线(网格)
h = legend([F2,F1,F3],'六分科技','千寻位置','标定数据'); %加一个图例,句柄h。
set(h,'fontsize',16,'edgecolor','w','textcolor','k') ; %对图例h进行精细设置
%text(indexQX(QXindex),horizontalQX(QXindex),'o','color','r');
%标记最大值
text(indexQX(QXindex),horizontalQX(QXindex),['(',num2str(indexQX(QXindex)),',',num2str(horizontalQX(QXindex)),')'],'color','b');
text(indexLF(LFindex),horizontalLF(LFindex),['(',num2str(indexLF(LFindex)),',',num2str(horizontalLF(LFindex)),')'],'color','k');
text(indexQX(QXindexmin),horizontalQX(QXindexmin),['(',num2str(indexQX(QXindexmin)),',',num2str(horizontalQX(QXindexmin)),')'],'color','b');
text(indexLF(LFindexmin),horizontalLF(LFindexmin),['(',num2str(indexLF(LFindexmin)),',',num2str(horizontalLF(LFindexmin)),')'],'color','k');
h1=title("闵行高架下(全遮挡)—水平误差");
set(h1,'fontsize',16);