如何删除包含所有整数的矩阵行? [英] How do i remove matrix rows that contain all integers?
本文介绍了如何删除包含所有整数的矩阵行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我有一个7x3的矩阵,其中包含整数和非整数.我想要的是删除仅包含整数的所有行.示例如下:
Assuming I have a 7x3 matrix which contains both integers and non-integers. What i would want is to remove all rows containing only integers. An example is as follows:
A = [1, 1, 2
2, 1.5, 1
3, 1.5, 2
1, 2, 1
2, 2.5, 1
3, 2.5, 1
1, 3, 2];
我的输出应该是:
B = [2, 1.5, 1
3, 1.5, 2
2, 2.5, 1
3, 2.5, 1];
请,我怎么可能做到这一点?谢谢.
Please, how can I possibly achieve this? Thank you.
推荐答案
B = A;
B(all(mod(A,1)==0, 2), :) = [];
这篇关于如何删除包含所有整数的矩阵行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文