Hello,
say, A==[0,0,1,2,3,3,6,6; 8,4,5,6,7,7,8,2; 9,9,10,10,11,12,22,45; 0,1,0,2,7,8,16,17; 0 0 0 0 0 0 1 1];
I need to delete the entire rows if any one of them happens:
a) column 1= column2
b) column3 =column4
c)column5 = column6
d)column7 = column8
e) column 5=column8
so finally, i''ll get,
A= [0,1,0,2,7,8,16,17]
Could you please help me knowing this how to do?
(edited)

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2019년 1월 23일

1 개 추천

out = A(all(A(:,1:2:end) ~= A(:,2:2:end),2),:)

댓글 수: 4

Sky Scrapper
Sky Scrapper 2019년 1월 23일
편집: Sky Scrapper 2019년 1월 23일
sorry, i''ll have to put one more condition that if:
column 5=column8
then i will have to delete that row also.
Sky Scrapper
Sky Scrapper 2019년 1월 23일
please answer on the edited question.
Andrei Bobrov
Andrei Bobrov 2019년 1월 24일
out = A(all(A(:,[5,1:2:end]) ~= A(:,[end,2:2:end]),2),:)
Sky Scrapper
Sky Scrapper 2019년 1월 24일
thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2019년 1월 23일

댓글:

2019년 1월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by