MATLAB: Picking arrays from a matrix based on a condition

arrayscell arraysexcelmatricesmatrix arrayvector

Hi,
I have a matrix:
3 3 3 3 3 2 2 2 4 4
4 4 4 4 4 2 2 4 4 4
5 5 5 5 5 2 2 4 4 4
6 6 6 6 6 2 2 2 4 4
Suppose the first five elements in any row are represented by A (e.g., always the same value. for instance 3 in the first row) while the last five elements always include only two numbers i.e. B (equal to 2, in the first row) and C (equal to 4, in the first row)
How would I be able to pick those rows that hold: B<A<C. For instance, the below rows in the above case:
3 3 3 3 3 2 2 4 4 4
4 4 4 4 4 2 2 4 4 4
Many thanks.

Best Answer

M=[3 3 3 3 3 2 2 2 4 4;
4 4 4 4 4 2 2 4 4 4;
5 5 5 5 5 2 2 4 4 4;
6 6 6 6 6 2 2 2 4 4]
[A,B,C]=deal(M(:,1),M(:,6),M(:,9));
M(B<=A & A<=C,:) % Not same criteria stated in your question
Gives:
ans =
3 3 3 3 3 2 2 2 4 4
4 4 4 4 4 2 2 4 4 4