how to cut the matrix
1 view (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
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)
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!