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

1 vue (au cours des 30 derniers jours)
yongjie
yongjie le 12 Juin 2024
Commenté : yongjie le 14 Juin 2024
A = [1 3 7; 6 4 2];
B = [1 3];两个矩阵怎么去同存异得到矩阵[6 4 2]

Réponses (1)

halleyhit
halleyhit le 13 Juin 2024
Modifié(e) : halleyhit le 13 Juin 2024
我猜你是要
setdiff(A,B)
但为啥A和B计算结果是642,7呢
  1 commentaire
yongjie
yongjie le 14 Juin 2024
C=setdiff(A(:,1:2),B,'rows')
D=A(ismember(A(:,1:2),C,'rows'),:)
应该这样

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB 快速入门 dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!