How to group array values over threshold?

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

 채택된 답변

David Hill
David Hill 2020년 4월 22일

0 개 추천

E=96;
x=(0:0.01:6.28);
V=206*sin(x);
vt=V(V>E);
vb=V(V<=E);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Types에 대해 자세히 알아보기

질문:

2020년 4월 22일

답변:

2020년 4월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by