Assuming I have a 23x3 matrix which contains both integers and non-integers. I would ideally want to remove some of the matrix rows based on the following criteria:
- Remove row if any 2 columns are non-integers
- Remove row if all 3 columns are non-integers
- Remove row if all columns are integers
The above implies that the rows that will be left should have only one non-integer
and two integers
Below is my matrix:
A = [1 1.5 1
1 2.5 1
1 3.5 1
1 1 1.5
1 1.5 1.5
1 2 1.5
1 2.5 1.5
1 3 1.5
1 3.5 1.5
1 4 1.5
1 1.5 2
1 2.5 2
1 3.5 2
1 1 2.5
1 1.5 2.5
1 2 2.5
1 2.5 2.5
1 3 2.5
1 3.5 2.5
1 4 2.5
1 1.5 3
1 2.5 3
1 3.5 3];
My final output should be:
B = [1 1.5 1
1 2.5 1
1 3.5 1
1 1 1.5
1 2 1.5
1 3 1.5
1 4 1.5
1 1.5 2
1 2.5 2
1 3.5 2
1 1 2.5
1 2 2.5
1 3 2.5
1 4 2.5
1 1.5 3
1 2.5 3
1 3.5 3];
I am still learning and still trying to find my feet on which way to go. Please, guys help me out with this one. Thank you!
|
) – Ander Biguri