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)=[];
  1 件のコメント
pruth
pruth 2018 年 6 月 6 日
perfect !!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by