How to extract two repeated toggling data from two fixed channel using MATLAB

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

Réponses (1)

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 commentaires

Thanks for responding.
I will check . I will utilize your suggestion.
Hi,
It is showing error
Subscripted assignment dimension mismatch in the line .
zdata(iD,:)=sscanf(ydata{iL},'%d %d')
% In short I want to say that ,let say there are 3 channel and
3 inputs are there.Inp-1,inp-2,inp-3. These inputs are coming through these
3 channel at particular time. Now these input may change their channel at
different time.Again input may not coming to channel during any time.
Now I want to check whether (say inp-1 corresponding to sv id) was present
throughout the test time. No matter in which channel appears.
At the same time in which time input was not appearing. So I want to extract only input
1 from these channel and plot them over time.
Hope my sentences makes some meaning now.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simulink dans Centre d'aide et File Exchange

Question posée :

le 7 Août 2017

Modifié(e) :

le 7 Août 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by