필터 지우기
필터 지우기

how to delete repeated rows ?

조회 수: 3 (최근 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