# I have a two column matrix and want to eliminate the rows whose interval contain a certain value

1 view (last 30 days)
Paramonte on 11 Apr 2018
Commented: Paramonte on 11 Apr 2018
Dear all I have a two column matrix such as:
A=[12 44; 56 78; 81 100; 110 200; 210 300;450 500; 600 710]
this matrix rows contains interval boundaries in points of a time series (electromyography)
A =
12 44
56 78
81 100
110 200
210 300
450 500
600 710
now I have a control vector such as:
vec_control=[60 115 460]
I want to eliminate the rows in A whose boundaries contain any value in vec_control, so to obtain:
A_new =
12 44
81 100
210 300
600 710
Any help please?
Many thanks in advance!!
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

David Fletcher on 11 Apr 2018
A=[12 44; 56 78; 81 100; 110 200; 210 300;450 500; 600 710]
vec_control=[60 115 460]
for iter=1:length(vec_control)
index=vec_control(iter)>=A(:,1)&vec_control(iter)<=A(:,2)
A(index,:)=[]
end
A =
12 44
81 100
210 300
600 710
##### 1 CommentShowHide None
Paramonte on 11 Apr 2018
David Fletcher Many , many thanks. Works perfectly and efficient Regards

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!

Translated by