How to group array values over threshold?

3 visualizaciones (últimos 30 días)
Seba.V
Seba.V el 22 de Abr. de 2020
Respondida: David Hill el 22 de Abr. de 2020
Hi there
Given a set of values in an array i would like to split the arrays values in 2 groups. One holds the values of the array under the threshold value and the other one the values higher than the threshold value.
Here's my not very successful attempt to do so:
E=96;
x=(0:0.01:6.28);
V=206*sin(x);
for i=1:length(x)
if V(i)>E
vt(i)=V(i);
else
vb=V(i);
end
end
Any suggestions to generate better arrays?
Thank you in advance

Respuesta aceptada

David Hill
David Hill el 22 de Abr. de 2020
E=96;
x=(0:0.01:6.28);
V=206*sin(x);
vt=V(V>E);
vb=V(V<=E);

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by