reduce rows of a due to b

조회 수: 1 (최근 30일)
JL
JL 2019년 8월 30일
답변: Jos (10584) 2019년 8월 30일
Hi everyone, I have 2 matices, A and B
a = [0 1 0
0 1 1
1 0 1
1 1 1];
b =[1 1 1
0 1 1];
Is it possible to reduce a using b?
  댓글 수: 2
madhan ravi
madhan ravi 2019년 8월 30일
Expected result?
JL
JL 2019년 8월 30일
c = [0 1 0
1 0 1];
Sorry to include it

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

채택된 답변

madhan ravi
madhan ravi 2019년 8월 30일
ix = ismember(a,b,'rows');
a(ix,:) % gives you the rows in a which is common to b and ~ix vice versa
  댓글 수: 3
madhan ravi
madhan ravi 2019년 8월 30일
Did you see the comment?
a(~ix,:)
JL
JL 2019년 8월 30일
great thanks!

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

추가 답변 (1개)

Jos (10584)
Jos (10584) 2019년 8월 30일
You can simply use setdiff with the rows option ...
c = setdiff(a,b,'rows')

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by