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

3 views (last 30 days)
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!!

Accepted Answer

David Fletcher
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

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!