Borrar filtros
Borrar filtros

how to cut the matrix

1 visualización (últimos 30 días)
Quynh tran
Quynh tran el 11 de Mayo de 2017
Comentada: Quynh tran el 11 de Mayo de 2017
Dear all, I have a matrix like this:
[1 0.1
2 0.2
3 0.3
4 0.5
5 0.6
6 1.2
7 1.2
8 1.3]
I want to cut the matrix part which is less than 1.2
It means that the result is:
[1 0.1
2 0.2
3 0.3
4 0.5
5 0.6]
Could you help me to write code for this. Thanks.

Respuesta aceptada

James Tursa
James Tursa el 11 de Mayo de 2017
x = [1 0.1
2 0.2
3 0.3
4 0.5
5 0.6
6 1.2
7 1.2
8 1.3];
>> y = x(x(:,2)<1.2,:)
y =
1.0000 0.1000
2.0000 0.2000
3.0000 0.3000
4.0000 0.5000
5.0000 0.6000

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by