reduce rows of a due to b
1 次查看(过去 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?
采纳的回答
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 个评论
更多回答(1 个)
Jos (10584)
2019-8-30
You can simply use setdiff with the rows option ...
c = setdiff(a,b,'rows')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!