how to break the loop
이전 댓글 표시
I have a matrix p;
0.1996
0.4428
0.5227
0.8407
0.8929
0.9102
0.9528
0.8986
now, i only need points until they are increasing. Once the value decreases i need to break the loop and end the process. here i have tried to use the loop,
for i=1:length(p)
if p(i,1)<p(i+1,1)
one(i,:)=p(i+1,:)
else h=p(i,:)
end
end
but it only gives the result till 0.9102. I also want to include the value 0.9528 and then break the loop.(i need to break the loop here because my matrix is nearly 100*2 and this condition might be true in the next rows). What am i doing wrong?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!