两个不同维度的矩阵进行筛选。

3 Ansichten (letzte 30 Tage)
百家乐游戏怎么注册【tlyf002 .com】
如题,我有两个矩阵A=[1,2,3;4,5,6;7,8,9;10,11,12;13,14,15;16,17,18;19,20,21]
B=[1,2;7,8;19,20]
我想用B的两列元素来筛选A,即得到C=[1,2,3;7,8,9;19,20,21]
请问怎么做比较方便快捷呢?我的数据样本很大,以上是个示意

Antworten (1)

百家乐注册【www.xbs3512.com】
没注意,之前有个地方写反了,抱歉。下面这是对的:
C=A(ismember(A(:,1:2),B,'rows'),:)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!