how to delete repeated rows ?

2 Ansichten (letzte 30 Tage)
pruth
pruth am 6 Jun. 2018
Kommentiert: pruth am 6 Jun. 2018
hi i have created a mat file. (attached ) it is in cell format. some rows are given bellow.
'MRR 180531000700 UTC+0530 AVE 60 STP 200 ASL 650 SMP 125e3 SVS 6.0.0.8 DVS 6.10 DSN 0510076783 CC 3024153 MDQ 100 TYP AVE'
'RR 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.12 0.00 0.00 0.00 0.00'
'MRR 180531000800 UTC+0530 AVE 60 STP 200 ASL 650 SMP 125e3 SVS 6.0.0.8 DVS 6.10 DSN 0510076783 CC 3024153 MDQ 100 TYP AVE'
'RR 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.14 0.00 0.00 0.00'
'MRR 180531000900 UTC+0530 AVE 60 STP 200 ASL 650 SMP 125e3 SVS 6.0.0.8 DVS 6.10 DSN 0510076783 CC 3024153 MDQ 100 TYP AVE'
'MRR 180531001000 UTC+0530 AVE 60 STP 200 ASL 650 SMP 125e3 SVS 6.0.0.8 DVS 6.10 DSN 0510076783 CC 3024153 MDQ 100 TYP AVE'
'MRR 180531001100 UTC+0530 AVE 60 STP 200 ASL 650 SMP 125e3 SVS 6.0.0.8 DVS 6.10 DSN 0510076783 CC 3024153 MDQ 100 TYP AVE'
'RR 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.10 0.00 0.00 0.00'
first row(MRR...) has date and time second row(RR...) has rain rate data. and the data structure repeated. but sometimes date is given but below that data is missing . so i want to delete that date rows which do not have any data bellow . so I will get the file like
MRR...
RR...
MRR...
RR...
MRR...
RR...
.
..
.
I hope you understand my question. thank you.
  2 Kommentare
Paolo
Paolo am 6 Jun. 2018
Rows 11 and 12 have different values for MMR.
MRR 180531000500 ...
MRR 180531000600 ...
respectively, however they are identical otherwise. In this example for two rows, do you want to eliminate row 12?
pruth
pruth am 6 Jun. 2018
thank you for your reply. I want to eliminate row number 11, not 12. because row number 12 has data below it. in that file there ample of such rows are present which I want to eliminate. sometimes there are 4 MRR rows are present one below other in this case I want to delete first 3 MRR rows. just like above example is given in question itself.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Rik
Rik am 6 Jun. 2018
How about this:
isMRR=cellfun(@(x) strcmp(x(1:3),'MRR'),data);
isRR=cellfun(@(x) strcmp(x(1:2),'RR'),data);
toBeDeleted=isMRR(1:(end-1)) & ~isRR(2:end);
data(toBeDeleted)=[];

Weitere Antworten (0)

Kategorien

Mehr zu Dates and Time finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by