How to extract two repeated toggling data from two fixed channel using MATLAB
    6 views (last 30 days)
  
       Show older comments
    
Hi Friends,
I have a text file looks like below 
Time 20.20
Channel   SVID
01         5
02         7
03         1   
Time  20.40 
same sequence...
Time  20.60
01         1
02         7
03         5  
Time  20.80
01         1
02         7
03         --  
....... 
As you can see in the 3rd time interval my satellite number 1 and 5 swap to channel 
01 and 03. Earlier I was extracting data through channel wise using index method because 
all channel and time will be repeating after particular sequence. But when I was extracting data 
let say through  channel 01 means actually I am taking two satellite id value 5 and 1.But again at time 20.80
satellite 05 is missed. So if I plot accordingly  channel then I can not know what time my satellite 05 became invisible and giving me wrong information 
about that satellite. I want to exactly what time it missed. If at all it is not missed but switching to different channel then how to extract data .
My channel sequence is fixed. 
 I extracted data using 
 fid=fopen('testingGPS.txt','r');
xdata=textscan(fid,'%s','delimiter','\n');
ydata=xdata{1};
zdata=ydata(4:24:end,:);%GPS-Channel-05
kdata=ydata(20:24:end,:);%SBAS-Channel-01
 But as I said my plot giving me wrong information.
 No logic is working at this moment.
 Any help is highly appreciated
 Thanks 
 POKA
0 Comments
Answers (1)
  fbaillon
      
 on 7 Aug 2017
        If I understand your question correctly, you can write something like that:
fid=fopen('testingGPS.txt.txt','r');
xdata=textscan(fid,'%s','delimiter','\n');
ydata=xdata{1};
ydata=cellfun(@(x) strrep(x,'--','0'),ydata,'UniformOutput',false);
iD=1;
for iL=2:4:length(ydata)
    zdata(iD,:)=sscanf(ydata{iL},'%d %d');%GPS-Channel-05
    kdata(iD,:)=sscanf(ydata{iL+2},'%d %d');%SBAS-Channel-01
    iD=iD+1;
end
fclose(fid);
%
zdata=zdata(:,2);
kdata=kdata(:,2);
%
2 Comments
See Also
Categories
				Find more on Reference Applications in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
