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

2 visualizaciones (últimos 30 días)
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!!

Respuesta aceptada

David Fletcher
David Fletcher el 11 de Abr. de 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

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by