matlab如何实现两个矩阵的去同存异

A = [1 3 7; 6 4 2];
B = [1 3];两个矩阵怎么去同存异得到矩阵[6 4 2]

回答(1 个)

halleyhit
halleyhit 2024-6-13
编辑:halleyhit 2024-6-13

0 个投票

我猜你是要
setdiff(A,B)
但为啥A和B计算结果是642,7呢

1 个评论

yongjie
yongjie 2024-6-14
C=setdiff(A(:,1:2),B,'rows')
D=A(ismember(A(:,1:2),C,'rows'),:)
应该这样

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 MATLAB 快速入门 的更多信息

提问:

2024-6-12

评论:

2024-6-14

Community Treasure Hunt

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

Start Hunting!