Extracting matrix from a matrix based with condition

How can I extract matrix from matrix with condition for value in column? I have matrix A [6x6] and I need get matrix B,which value of column num.6 is more than 2 and less than 7.
A=[4, 5, 6, 2, 7, 3; 8, 9, 5, 4, 5, 1; 4, 5, 6, 2, 7, 9; 8, 9, 5, 4, 5, 8; 8, 1, 1, 1, 1, 2; 5, 6, 2, 2, 4, 6]
Answer will be: B=[4, 5, 6, 2, 7, 3; 5, 6, 2, 2, 4, 6]

Respuestas (1)

Guillaume
Guillaume el 3 de En. de 2017
B = A(A(:, 2)>2 & A(:, 2)<7, :)
which shows that your example answer is missing a row.

Categorías

Preguntada:

el 3 de En. de 2017

Comentada:

el 4 de En. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by