how to cut the matrix

1 view (last 30 days)
Quynh tran
Quynh tran on 11 May 2017
Commented: Quynh tran on 11 May 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.

Accepted Answer

James Tursa
James Tursa on 11 May 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

More Answers (0)

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!