how to delete repeated rows ?
2 次查看(过去 30 天)
显示 更早的评论
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
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?
采纳的回答
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 Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!