From 247eeb2bbb784296b8fed78793e4624e4d17d6cc Mon Sep 17 00:00:00 2001 From: miguekf Date: Tue, 3 Jan 2023 18:51:13 +0100 Subject: [PATCH] FIX: matlab spirent import bug when a constellation is not present. --- src/utils/matlab/vtl/SpirentSatData2struct.m | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/utils/matlab/vtl/SpirentSatData2struct.m b/src/utils/matlab/vtl/SpirentSatData2struct.m index 37e930ebd..640e5ad38 100644 --- a/src/utils/matlab/vtl/SpirentSatData2struct.m +++ b/src/utils/matlab/vtl/SpirentSatData2struct.m @@ -99,15 +99,18 @@ refSatData.BEIDOU=[]; [indGALILEO,~]= find(strcmp(satdataV1A1SPFLD1, 'GALILEO')); [indGPS,~]= find(strcmp(satdataV1A1SPFLD1, 'GPS')); -GAL=satdataV1A1SPFLD1(indGALILEO,:);GAL(:,3)=[]; -GPS=satdataV1A1SPFLD1(indGPS,:); GPS(:,3)=[]; -GAL=cell2mat(GAL); -GPS=cell2mat(GPS); - %% SPIRENT SAT SOLUTION +if(~isempty(indGALILEO)) + GAL=satdataV1A1SPFLD1(indGALILEO,:);GAL(:,3)=[]; + GAL=cell2mat(GAL); +end +if(~isempty(indGPS)) + GPS=satdataV1A1SPFLD1(indGPS,:); GPS(:,3)=[]; + GPS=cell2mat(GPS); +end + +if(~isempty(indGALILEO)) refSatData.GALILEO.SIM_time=unique(GAL(:,1),'first'); - refSatData.GPS.SIM_time=unique(GPS(:,1),'first'); - %% k=0; for i=1:length(refSatData.GALILEO.SIM_time) nsats=length(find(GAL(:,1)==refSatData.GALILEO.SIM_time(i))); @@ -145,7 +148,10 @@ GPS=cell2mat(GPS); end end +end %% ------------------------------------- +if(~isempty(indGPS)) + refSatData.GPS.SIM_time=unique(GPS(:,1),'first'); k=0; for i=1:length(refSatData.GPS.SIM_time) nsats=length(find(GPS(:,1)==refSatData.GPS.SIM_time(i))); @@ -182,7 +188,7 @@ GPS=cell2mat(GPS); refSatData.GPS.series(i).sat_Acc_Z(j) = GPS(k,49); end end - +end % Clear temporary variables clear satdataV1A1SPFLD05 GPS GAL end