how to delete repeated rows ?

2 次查看(过去 30 天)
pruth
pruth 2018-6-6
评论: pruth 2018-6-6
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 个评论
Paolo
Paolo 2018-6-6
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 2018-6-6
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.

请先登录,再进行评论。

采纳的回答

Rik
Rik 2018-6-6
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)=[];

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by