finding the last element of an array that fulfils a condition
이전 댓글 표시
hi , i want to calculate the difference inside a loop: diff=0.0002; for i=1:length(k) if diff(i)<=diff result=i; end end i want to save the last i (condition fulfilled) and not to the first one . Is that possible?
답변 (1개)
Walter Roberson
2018년 5월 24일
0 개 추천
Use find() with the 'last' option
카테고리
도움말 센터 및 File Exchange에서 Data Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!