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

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

Respuestas (1)

halleyhit
halleyhit el 13 de Jun. de 2024
Editada: halleyhit el 13 de Jun. de 2024

0 votos

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

1 comentario

yongjie
yongjie el 14 de Jun. de 2024
C=setdiff(A(:,1:2),B,'rows')
D=A(ismember(A(:,1:2),C,'rows'),:)
应该这样

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB 快速入门 en Centro de ayuda y File Exchange.

Preguntada:

el 12 de Jun. de 2024

Comentada:

el 14 de Jun. de 2024

Community Treasure Hunt

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

Start Hunting!