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

2 次查看(过去 30 天)
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!!

采纳的回答

David Fletcher
David Fletcher 2018-4-11
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by