using function to remove elements from a large matrix
1 次查看(过去 30 天)
显示 更早的评论
I need to code for a matrix in which the rows are removed given thier value in a certain column is not of desire to me. eg, I want to keep the numbers 1 2 3 and 11 and 12 but not 4 5 6 or 13 14 etc.
3 个评论
采纳的回答
the cyclist
2019-12-25
编辑:the cyclist
2019-12-25
idxToKeep = ismember(M(:,2),[1,2,3,11,12]);
M = M(idxToKeep,:);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!