MATLAB: Delete rows of a matrix based on specific column threshold values

matrixthreshold

Hello Guys
I have a .xlsx matrix loaded in matlab (600×20 size). One of the colums define where the interesting parts is. Thats where the value is above a certain threshold.
Question is; How do i cut down my entire matrix so i still have all colums left?
Example:
A = [ 1 2 1 2 3 2 1
1 2 3 4 3 1 4
2 4 3 2 5 2 5
2 3 4 3 2 4 6
4 3 2 4 2 4 2]
Column 7 is the threshold vector. I need to cut away entire rows based on this threshold vector. If threshold is set to minimum 3, then the above matrix must look like this, where row 1 and row 5 is removed from new matrix:
A = [ 1 2 3 4 3 1 4
2 4 3 2 5 2 5
2 3 4 3 2 4 6]
The logs created can by very big. So i need a solution that works with "readtable" function.
Thank you! 😉
Regards

Best Answer

A = [ 1 2 1 2 3 2 1
1 2 3 4 3 1 4
2 4 3 2 5 2 5
2 3 4 3 2 4 6
4 3 2 4 2 4 2]
index = A(:, 7) < Thresh;
A(index, :) = [];
"i need a solution that works with "readtable" function."
Of course you can apply this to data imported by readtable . But there is no way to filter the data magically during the import.