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

1 回表示 (過去 30 日間)
yongjie
yongjie 2024 年 6 月 12 日
コメント済み: yongjie 2024 年 6 月 14 日
A = [1 3 7; 6 4 2];
B = [1 3];两个矩阵怎么去同存异得到矩阵[6 4 2]

回答 (1 件)

halleyhit
halleyhit 2024 年 6 月 13 日
編集済み: halleyhit 2024 年 6 月 13 日
我猜你是要
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'),:)
应该这样

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB 快速入门 についてさらに検索

Community Treasure Hunt

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

Start Hunting!