keep the same row data from two matrix
2 次查看(过去 30 天)
显示 更早的评论
i have a total data matrix a(253*2), now i just want to keep the data from b(223*1) and get the whole data is c(223*2), which means that keep the same data between a&b. how should i do?
3 个评论
Mathieu NOE
2021-3-25
OK so you have to use find the get the similar values from col 1 in a and b
ind = find(a(:,1) == b);
c = a(ind,:);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!