MATLAB: Threshold for each column of a mxn matrix

threshold

Hi, if say I have a m x n matrix and I want to set a certain threshold for column 1 and certain threshold for column 2, how can I do this please?
For example, if I have
[1 11
2 12
3 13
4 14
5 15]
and I want to set column1>2 AND at the same time column2<15, which means at the end will left
[3 13
4 14]
how can i code this please? this is just an example as my data file is actually much bigger. Thank you very much.

Best Answer

Try this:
m = [1 11
2 12
3 13
4 14
5 15]
rowsToKeep = m(:,1) > 2 & m(:, 2) < 15
out = m(rowsToKeep, :)